c++ - Impossible to inherit from this object? -
Later on, people have suggested that I go with "option 3" which can look like this:
class = b2body {private: b2Body () {} friend class b2World; }; Class Body: Public B2 Body (Private: Body () {} Friend class World;}; Class B2World {Public: b2Body * CreateBody () {New b2Body Return;}}; Class World: Public B2 World {Public: Body * Creative () {new body returns;}}; int main () {world w} body * b = w.CreateBody (); return 0;}
< P> But it has two major problems:
- body can never be created
World :: CreateBody
also ( Becauseb2body
private - Regardless of this, then
b2body
part
Does this mean that I have never used code 2 body / b2 world
and follow this design pattern? (Keep in mind that I can not edit B2 * classes)
If so , Then I think that you guys would recommend that I b2World
and b2Body
instead of the member variable?
I think That it now comes in these two options:
can only make b2World
a b2board
, so it does not go anywhere, these sections are clearly Yes, it is not designed to be inherited, instead of their total. Class body (public: body (B2BD * B): B2B (B) {} Personal: B2 body * Const B2B;}; World class {Public: World (): B2W (/ * B2V Build * /) {} Body * CreativeBody () {New Body Back (B2W-> Creedy (/*...*/);}} Personal : B2World * const b2w;};
Comments
Post a Comment