## 20.6 Private Inheritance and Names

- Inheritance normally implies an "is-a" relationship
  - Substitution principle: If `B` inherits from `A`, then `B` can be used wherever `A` is expected
  - Interface for the base class becomes a basis for the i/f for the derived class
- We occasionally use inheritance even when the "is-a" relationship doesn't hold (see example)
  - A solution is to declare that `Set` inherits privately from `List`
  - With private inheritance all inherited attributes become private in the derived class
  - The base class' interface does not flow through to the derived class

prev |top |next