Hi
I've been reading about c++ for a while but I have to say that I lack hands on experience.
I want to create 3 objects; car, mainPart, subPart in shuch a way that I can write something like this:
basically 'car' has a number of mainParts, and each mainPart has a number of subParts. The number of elements in the mainPart and subPart arrays are defined by the user at runtime.Code:car.mainPart[11].subPart[33].someFunction
it is possible to do the above without exposing the member of mainPart and subPart?
If I have to expose the members using 'public:' is it better to use a structure instead of a class?
Is there a better way to implement the above (maybe y using inheritance)? if yes then how?
Thanks for the help.



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.