October 2011
Beginner to intermediate
1200 pages
35h 33m
English
Naturally, adding inheritance to a program brings up a number of considerations. Let’s look at a few.
You should be guided by the is-a relationship. If your proposed derived class is not a particular kind of the base class, you shouldn’t use public derivation. For example, you shouldn’t derive a Programmer class from a Brain class. If you want to represent the belief that a programmer has a brain, you should use a Brain class object as a member of the Programmer class.
In some cases the best approach may be to create an abstract data class with pure virtual functions and to derive other classes from it.
Remember that one expression of the is-a relationship is that a base class ...
Read now
Unlock full access