Classes with Other Classes as Member Data
Hi,
I am learning C++ at the moment and I am struggling with the following:
Classes with Other Classes as Member Data.
I am wondering if anyone could show me a quick (commented) example of how this works.
This is from the book I am learning from BTW:
It is not uncommon to build up a complex class by declaring simpler classes and including them in the declaration of the more complicated class. For example, you might declare a wheel class, a motor class, a transmission class, and so forth, and then combine them into a car class. This declares a has-a relationship. A car has a motor, it has wheels, and it has a transmission.
I basically could do with a simpler example so I can get my head around it easier than the example given in the book.
Thanks in advance.