quote:Original post by alnite
What does that mean?
Well, it doesn''t mean that there is any structural relationship between instances of class A and class B. In C++, a class serves two purposes. The main purpose is to specify the data and behaviour for objects of that class. The secondary purpose is to effectively serve as a namespace (which, IMO, is stupid). In your example code, class B lives within the namespace scope of class A, but there is no relationship between class A and class B objects.
quote:
Can you please provide a practical example of this (game-development wise)?
It''s actually quite rare to find a practical use. I''ve used it in the past, but I can''t remember why (I think it was something to do with subclassing from a common interface and returning objects where the outside world knew about the interface but not the concrete class). These days, I''d be more inclined to let the outside world see class B, on a basis of trust. i.e. I trust my fellow developers to not use classes in a context that doesn''t make sense.
quote:Original post by chollida1
You would use this for an object that ownes somthing(has a)
It doesn''t express *any* structural relationship between objects.