I have a base class "node" which has a list of hair nodes, node defines an "forEnchNode" function Takes a callback as a parameter and calls it on each node in the hierarchy.
I have a square from the node - choose "special node" - just an example!). Node does not know anything about the special node.
I want to iterate only on special nodes. I have found at that point where the special node defines callback to pass "forEnNode", but I'm not sure how to call callbacks of SpecailNodes only, how any advice?
You can try to do something like this:
if (Dynamic_cast & lt; Special node * & gt; (N)! = Null) {do_something (); }
Or you place a virtual function in the node to call with callback, which you can apply in sub-complexes differently.
Comments
Post a Comment