Пример #1
0
        static void Main(string[] args)
        {
            var i   = new IntegerData();
            var d   = new DoubleData();
            var inc = new IncVisitor();
            var dec = new DecVisitor();

            i.AcceptVisitor(inc);
            d.AcceptVisitor(dec);

            Console.WriteLine(i.Value);
            Console.WriteLine(d.Value);
        }
Пример #2
0
 public void VisitDouble(DoubleData data)
 {
     data.D -= .1;
 }