emily li wrote:...
... but is that a good design?
does aMemberOfB keep the reference of A or a whole copy? will this design cause any performance problem?
i worked on C for a while. i know this kind of structure is not allowed in C (or maybe just hard to implement in C). that's why i comes up this question.
sorry, i didn't make myself clear. hope this help to clarify my question/concern.
thanks,
This post was more clear, i think. it just keeps a reference to the object instantiated from class A ( or made of A ! ) and not only cause any problem, but makes sense to interaction between objects: that's the way they can call each other!
You can just figure it out by answering the question:
how to call a method of class A from within class B ?
of course you need to have a reference to A to point to it from B (or anywhere outside A)
Look at another example i think will make more sense even: