Exemple #1
0
        static void Main(string[] args)
        {
            var trainer  = new Trainer();
            var student1 = new Student("Risto");
            var student2 = new Student("Trajan");

            trainer.EventHandler += student1.Hear;
            trainer.EventHandler += student2.Hear;

            trainer.Announce("Risto", 5);
            trainer.Announce("Trajan", 8);
            trainer.Announce("Nekoj", 6);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Trainer kristina = new Trainer();

            Student nikola = new Student("Nikola");
            Student marija = new Student("Marija");
            Student jana   = new Student("Jana");
            Student ivan   = new Student("Ivan");
            Student gligor = new Student("Gligor");

            kristina.EventHandler += nikola.Hear;
            kristina.EventHandler += marija.Hear;
            kristina.EventHandler += jana.Hear;
            kristina.EventHandler += ivan.Hear;
            kristina.EventHandler += gligor.Hear;

            kristina.Announce("Gligor", 9);
            kristina.Announce("Nekoj", 10);
            kristina.Announce("Jana", 10);
            kristina.Announce("Ivan", 5);
            kristina.Announce("Pero", 7);
            kristina.Announce("Nikola", 9);

            Console.ReadLine();
        }