L
Le Géant Vert
Dave said:Hi
I'm making a 3D Engine which consists of the class C3DEngine. Part of this
engine is a file loader, a class called CMeshLoader.
I have made an instance of CMeshLoader in C3DEngine, ie composition.
Unfortunately, CMeshLoader sometimes needs to refer
to private members of C3DEngine. Inheritance, friends, and composition are
all swirling around in my head at the moment. I know that
inheritance is not the solution. Can someone please suggest an elegant way
of solving this problem?
Cheers
dave
in the class C3DEngine, what about just supplying getters to read the
private members, and matching setters to write them ?
anyway, a class using a second one which needs data from the first, doesn't
seem really right for me.... ? maybe you should wonder about the conception
and WHY does your mesh loader need data from the engine, and maybe there's
some way to externalize or refactor parts of code to make it more intuitive.