|
-
Jul 31st, 2010, 01:23 PM
#3
Re: Inheritance and copy/use of member instances
Why assume that B inherits A? The OP didn't mention that, and it would make for a really bizarre situation, since A has a B, which inherits from A, so it has all the properties of an A.
The way you posted this, there is no clear way for B to access A. B is a member of A, but has no knowledge of A, intrinsically, nor should it. If B is a stand alone class, as it should be, then it should not be dependent on the existence of any other class. Therefore, for it to be aware of any part of A, then A would have to be passed in to B as an argument to a method. It is uncommon, but not at all unheard of, to have A have a B, which is passed A as part of its constructor. This would allow B to access A, and A to access B.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|