public void Visit(AdditionExpression obj) { sb.Append("("); obj.Left.Accept(this); sb.Append("+"); obj.Right.Accept(this); sb.Append(")"); }
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); WriteLine(ep.ToString()); }