< Previous | Contents | Next >
Controlling Access under Inheritance
When you derive one class from another, you can control how much access the derived class has to the base class’ members. For the same reasons that you want to provide only as much access as is necessary to a class’ members to the rest of your program, you want to provide only as much access as is necessary to a class’ members to a derived class. Not coincidentally, you use the same access modifiers that you’ve seen before—public, protected, and private. (Okay, you haven’t seen protected before, but I’ll explain that modifier in the “Using Access Modifiers with Class Members” section.)
338 Chapter 10 n Inheritance and Polymorphism: Blackjack