How to understand FAQ 24.4

T

thomas

link: http://www.parashift.com/c++-faq-lite/private-inheritance.html#faq-24.4

There's a sentence:

"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. "

Does it mean that PrivatelyDer decides to make the base class private,
so users should not publicly use a base pointer? Because private
inheritance intends the hide of base class, the use of Base type
pointer should be avoided.
 
J

James Kanze

There's a sentence:
"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. "
Does it mean that PrivatelyDer decides to make the base class private,
so users should not publicly use a base pointer? Because private
inheritance intends the hide of base class, the use of Base type
pointer should be avoided.

It means that private inheritance, like anything else private,
is an implementation detail, not part of the contract, and the
client code shouldn't count on it; the authors of client code
should, in fact, code as if it didn't exist, or at least as if
they don't know of its existance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,122
Latest member
VinayKumarNevatia_
Top