Exemple #1
0
        static void Main(string[] args)
        {
            List <string> lions = new List <string>()
            {
                "Mufasa", "Scar", "Simba"
            };
            List <string> wolves = new List <string>()
            {
                "Zanna", "Giallo"
            };
            List <string> listaAnimali = new List <string>();

            #region EntraAddestratore

            Persona Igor = new Addestratore();
            Igor.nome = "Igor";
            ((Addestratore)Igor).salutaPubblico();
            #endregion

            #region InizioShow

            //Fa entrare i leoni
            foreach (var leone in lions)
            {
                Animale leo = new Leone();
                leo.nome = leone;
                leo.ascolta((Addestratore)Igor);
                leo.salutaEntrando();
                listaAnimali.Add(leo.nome);
            }
            //Fa entrare i lupi
            foreach (var lupo in wolves)
            {
                Animale wolf = new Leone();
                wolf.nome = lupo;
                wolf.ascolta((Addestratore)Igor);
                wolf.salutaEntrando();
                listaAnimali.Add(wolf.nome);
            }

            /*
             * foreach (var animale in listaAnimali)
             * {
             *  Console.WriteLine(animale + " entra in pista!");
             * }*/

            Task <Byte[]> novita = Igor.leggiGiornale("http://www.repubblica.it");

            ((Addestratore)Igor).RiceviElenco(listaAnimali);
            ((Addestratore)Igor).FaiAppello();

            #endregion
        }
Exemple #2
0
 public void ascolta(Addestratore MyNewMaster)
 {
     MyMaster             = MyNewMaster;
     MyMaster.haChiamato += MyMaster_haChiamato;
 }