Is there a best practice (or some pattern) for working with a tree that contains different classes? I am talking from the GUI perspective. Once I have the tree displayed, how can I know in advance what object is being selected?
Thank you for your help.
It’s not a problem if they have a common superclass or interface. In any case, you should be dealing with common superclass or interface. You should start rethinking your design the moment you find yourself checking types and casting. You should be leveraging polymorphism.