Posted on 2002-04-22
A while ago I asked a question and someone said "use aggregation." I'm still not seeing how to do this in my situation (probably due to my lack of understanding aggreation) so I'd like some discussion on the matter. PLEASE HELP...
Here is the situation, simplified:
Think of a TTreeView in COM. We would have a ITreeView and an ITreeNode. The ITreeView should be able to hold ANY ITreeNode (unless programmed to only contain certain "kinds" of nodes), where the ITreeNodes could actually be programmed by multiple different programmers from anywhere in the world (local to my organization and outside) and registered for use (I got the registration part figured out already...).
So how would this be done considering that the ITreeView must have Nodes collection and each ITreeNode must "know" which ITreeView "owns" it? Additionally, a ITreeNode must be able to "disown" from an ITreeView and switch to being owned by another one. Is aggregation really how to do this? If so, how? If not, how can it be done?
Feel free to offer suggestions and examples if you have any. Anyone getting me on the right track to implementation will get the points, so put your best foot forward.