[Exceptional C++ Style] Item 14: Order, Order!

Ric Parkin ric.parkin at ntlworld.com
Fri Dec 10 04:11:15 EST 2004


From: Raj Jammalamadaka <cppuser2002 at yahoo.com>

Just the one comment

> Guideline suggested: Avoid using inheritance.

I was going to suggest that ought to be "avoid using inheritance *unnecessarily*", then checked the book and Herb says "Avoid overusing inheritance"

> Except for friendship, inheritance is the strongest
> relationship that can be expressed in C++ and should
> be used only when it’s necessary.



Here's a slightly interesting one - is friendship stronger than inheritance? 

In one way, yes: a friend has full access to a class, whereas a derived class can't see the base's private members.

In another way, no: to the client, the friend is just another class/method, whereas the derived class IsA base class, with all the implicit conversions implied.

Ric




-----------------------------------------
Email provided by http://www.ntlhome.com/





More information about the Effective-cpp mailing list