Examples of Public and Private Derivation

In the following example, class d is derived publicly from class b. Class b is declared a public base class by this declaration.

class b
{
// ...
};
class d : public b // public derivation
{
// ...
};

In the following example, private derivation is used by default because no access specifier is used in the base list:

struct bb
{
// ...
};
class dd : bb // private derivation
{
// ...
};