I have defined a type representing a node in an execution tree. Sometimes it only contains a variable, sometimes it contains an operator and 1 or 2 arguments. Now I want to display it as a string by recursing down the tree, and I’m not sure what I should be overloading to achieve this.
The documentation seems to be saying that string()
calls show()
, and that I should therefore overload show()
, but show()
also contains the argument io
, and I don’t see how to concatenate the strings that result from the recursive calls down the tree. I assume I have misunderstood something, but I can’t find an explanation that I can understand.