While it is possible for inheritance to be non-``++public++``, it is rarely justified and complicates the use of the derived class. For instance, inherited member visibility is diminished and implicit and ``++static_cast++`` casts from the derived class to the base class will not work. 


It is sometimes used to limit the base class functionality available in the derived class. When that is the desire, composition should be used instead.


== Noncompliant Code Example

----
class B : private A {  // Noncompliant
  // ...
}
----


== Compliant Solution

----
class B : public A {
  // ...
}
----
or

----
class B {
  private: 
  A a;
  // ...
}
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
