Contents Up << >>

Should I pointer-cast from a "privately" derived class to its base class?

Generally, no.

From a method or friend of a privately derived class, the relationship to the base class is known, and the upward conversion from PrivatelyDer* to Base* (or PrivatelyDer& to Base&) is safe; no cast is needed or recommended.

However, users of PrivatelyDer should avoid this unsafe conversion, since it is based on a "private" decision of PrivatelyDer, and is subject to change without notice.