having one class inside another is a main principle in OOD, its called composition.
whether your doing it properly or not, is another question that i dont know the answer to.. as mentioned, theres very little code to analyze the situation.
are you trying to say 'an engine has a car'? at least thats what it looks like... you should have an engine object in the car class instead.
then again, i could be totally off, because im assuming this is what you want, but dont know because of the little code.
if this is an answer to your question, then good! if not, then please elaborate or give more code.. but dont overwhelm us with it.
|