Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Private inheritance is an uncommonly used (of three) modes of inheritance. Private inheritance denotes a 'is-implemented-in-terms-of' relationship between derived class and base class [0] . Private inheritance is usually inferior to composition [0] .
There are no real-world examples for private inheritance : it means nothing during software design, only during software implementation [0] . In the example below Widget is not a kind of Timer, but it uses some of the features of Timer.
struct Widget : private Timer //A derived class, private inheritance
{
};
[0] Scott Meyers . Effective C++ (3rd edition).ISBN:0-321-33487-6. Item 39: 'Use private inheritance judiciously'.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.