예제 #1
0
 public override void Visit(MultiplicationExpression me)
 {
     _sb.Append("(");
     me.LHS.Accept(this);
     _sb.Append("*");
     me.RHS.Accept(this);
     _sb.Append(")");
 }
예제 #2
0
        // change to Main to run.
        public static void Main(string[] args)
        {
            var simpleAddition = new AdditionExpression6(new Value(2), new Value(3));
            var ep             = new ExpressionPrinter5();

            ep.Visit(simpleAddition);
            Console.WriteLine(ep.ToString());

            var simpleMultiplication = new MultiplicationExpression(new Value(7), new Value(7));
            var ep2 = new ExpressionPrinter5();

            ep2.Visit(simpleMultiplication);
            Console.WriteLine(ep2.ToString());
        }
예제 #3
0
 public abstract void Visit(MultiplicationExpression me);