Пример #1
0
        static void Main(string[] args)
        {
            Robot r2d2 = new Robot("R2D2");

            Mum leila   = new Mum("Leila");
            Dad hanSolo = new Dad("Han Solo");

            leila.MakeBaby(hanSolo, "Kylo Ren");

            leila.Child.StartedCrying += r2d2.Comfort;
            leila.Child.StartedCrying += TheForce.ComfortChild;

            // NON posso invocare un evento fuori dalla classe
            // in cui l'ho dichiarato.
            //leila.Child.StartedCrying.Invoke(leila.Child);

            Console.Read();
        }
Пример #2
0
        public override void Run(IGUI guiHandler)
        {
            Mum   leila   = new Mum("Leila");
            Dad   hanSolo = new Dad("Han Solo");
            Robot r2d2    = new Robot("R2D2");
            Baby  benSolo = leila.MakeBaby(hanSolo, "Ben Solo");

            //benSolo.AddComforter(r2d2.Comfort);

            benSolo.StartedCrying += r2d2.Comfort;
            benSolo.StartedCrying += TheForce.ComfortChild;

            //benSolo.StartCrying();
            //benSolo.StartCrying();
            //benSolo.StartCrying();
            //benSolo.StartCrying();
            //benSolo.StartCrying();

            //benSolo.AddComforter(TheForce.ComfortChild);
            //benSolo.StartCrying();


            Console.ReadKey();
        }