Chapter 11 Margin Notes

General Note: An interesting chapter---it's full of a lot of theory. I would prefer that you not worry to much about the theoretics, and instead concentrate on the 'how' of Inheritance.

I hope you enjoy it! But in order to fully enjoy it, you'll need me to explain some of the nuances to you.

Page 502, Magnifying Glass, The most important thing to do at this point is to be sure of your terms. With inheritance, a class is derived from a base class (sometimes called a parent class, or as is the case with Java, a superclass). The derived class, not surprisingly, is called a derived class (sometimes called a child class, or as is the case with Java, a subclass).

Page 502, Why Use Inheritance? You can stop with the first sentence here. Use Inheritance because it allows you to reuse the code that someone else has written. Just like you go to Home Depot and pick up a faucet for your sink that someone else has built. No sense making your own!

Page 506, Magnifying Glass. Remember the concept of Private members from Chapter 10. If you make a member (variable or function) Private, its inherited class can't "see" it. Defining members as Protected is just like Private, with the exception that derived classes can see them. Bottom line: Make your members Private.

Page 507, Magnifying Glass. I'm not thrilled with the author's description of an Abstract Class. An Abstract class is one in which there are one or more abstract functions. Abstract functions are functions which have a signatures, but no implementation details. Abstract classes are created to 'force' programmers deriving classes from it to complete the implementation detail. Therefore, if you derive a class from an Abstract Base class, you will need to write the actual code for the Abstract functions in the Base class. Make sense?

Page 507, #ifndef AND #define. For now, don't worry too much about this. This header file will appear in multiple classes within this application---this compiler directive tells C++ to include the header file only if it has not already been included. Clear as mud?

Page 509. Notice the syntax to tell C++ that you are inheriting from a base class.

class Checking:public BankAccount