public void Visit(AdditionalExpression obj) { sb.Append("("); obj.Left.Accept(this); sb.Append("+"); obj.Right.Accept(this); sb.Append(")"); }
static void Main(string[] args) { var e = new AdditionalExpression( left: new DoubleExpression(3), right: new AdditionalExpression( left: new DoubleExpression(4), right: new DoubleExpression(8))); var ep = new ExpressionPrinter(); ep.Visit(e); Console.WriteLine(ep); Console.ReadKey(); }