Home Segments Index Top Previous Next

228: Mainline

Class objects inherit member variables from the class to which they belong, and from all that class's superclasses. Each box_car object, for example, has its own copy of every member variable declared in the box_car, box, container, and railroad_car classes.

Similarly, class objects inherit member functions from the class to which they belong, and from all that class's superclasses. You can, for example, work on a box_car object not only with member functions defined in the box_car class, but also with those defined in the box, container, and railroad_car classes, if any.