Exemplo n.º 1
0
        static void Main()
        {
            var monkey  = new Monkey();
            var lion    = new Lion();
            var dolphin = new Dolphin();

            var speak = new Speak();

            monkey.Accept(speak);
            lion.Accept(speak);
            dolphin.Accept(speak);

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main()
        {
            var monkey  = new Monkey();
            var lion    = new Lion();
            var dolphin = new Dolphin();

            var speak = new Speak();
            var jump  = new Jump();

            monkey.Accept(speak);
            monkey.Accept(jump);

            lion.Accept(speak);
            lion.Accept(jump);

            dolphin.Accept(speak);
            dolphin.Accept(jump);
        }
Exemplo n.º 3
0
 public void VisitLion(Lion lion)
 {
     lion.Roar();
 }
Exemplo n.º 4
0
 public void VisitLion(Lion lion)
 {
     Console.WriteLine("Jumped 7 feet! Back on the ground!");
 }
Exemplo n.º 5
0
 public void VisitLion(Lion lion)
 {
     lion.Shout();
 }