static void Main(string[] args)
        {
            Cat    cat    = new Cat();
            Dog    dog    = new Dog();
            Monkey monkey = new Monkey();

            Speak speak = new Speak();
            Eat   eat   = new Eat();

            cat.Accept(speak);
            cat.Accept(eat);

            dog.Accept(speak);
            dog.Accept(eat);

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Dog  dog  = new Dog();
            Cat  cat  = new Cat();
            Lion lion = new Lion();

            Speak speak = new Speak();

            dog.Accept(speak);
            cat.Accept(speak);
            lion.Accept(speak);

            Eat eat = new Eat();

            dog.Accept(eat);
            cat.Accept(eat);
            lion.Accept(eat);

            Console.ReadLine();
        }