示例#1
0
 public void Visit(AdditionExpression obj)
 {
     sb.Append("(");
     obj.Left.Accept(this);
     sb.Append("+");
     obj.Right.Accept(this);
     sb.Append(")");
 }
示例#2
0
        static void Main(string[] args)
        {
            var e = new AdditionExpression(
                new DoubleExpression(7),
                new AdditionExpression(
                    new DoubleExpression(8),
                    new DoubleExpression(9)));
            var ep = new ExpressionPrinter();

            ep.Visit(e);
            Console.WriteLine(ep.ToString());
        }
示例#3
0
        public static void Main(string[] args)
        {
            var e = new AdditionExpression(
                new DoubleExpression(1),
                new AdditionExpression(
                    new DoubleExpression(2),
                    new DoubleExpression(3)
                    )
                );
            var ep = new ExpressionPrinter();

            ep.Visit(e);
            Console.WriteLine(ep);
        }