<snip>
My problem is when you have a lot of subclasses to Node that you want to process in different ways the second example gets very deeply nested and hard to maintain. Is there a better way to deal with multiple downcasts like this?
The example above is crying out for an object-oriented solution. Add an abstract "Process" method to your base class, and lose all of the casts. If you absolutely can't do that, then you could build an if/elseif tree based on node.GetType(), although even that's pretty poor practice unless you absolutely can't use the OO approach. John =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
