示例#1
0
        public void Using()
        {
            var monkey  = new Monkey();
            var lion    = new Lion();
            var dolphin = new Dolphin();
            var visitor = new AnimalVisitor();

            monkey.Accept(visitor);
            lion.Accept(visitor);
            dolphin.Accept(visitor);
        }
示例#2
0
 public void Visit(Lion lion)
 {
     lion.Roar();
 }