public override void Visit(MultiplicationExpression me) { _sb.Append("("); me.LHS.Accept(this); _sb.Append("*"); me.RHS.Accept(this); _sb.Append(")"); }
// 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()); }
public abstract void Visit(MultiplicationExpression me);