Origins of inheritance

shap@eros.cis.upenn.edu shap@eros.cis.upenn.edu
Sat, 24 Oct 1998 20:49:23 -0400


> ... They all seem to have actually been right there, with Bjarne, at
> the moment of conception. If I had to guess, I would say it was a
> desire to create compatible types that got out of hand.

Bjarne was in love with the classes notion of Simula.  In Simula, it
had proven a convenient way to handle a bunch of interface-like
problems.  I think he may have felt that a full interface facility was
something the C++ world wasn't ready for, and inheritance was working
well for large parts of the Simula and SmallTalk communities (and
still does).

Also, doing interfaces well requires considerable link-time support,
and Bjarne had a firmly-held constraint that he didn't want to rely on
linker modifications.

> When what you are doing is not in fact the Decorator pattern, using
> inheritance will make the interface to your new type wider than what you
> need. You then need to add extra code to your sub-type to make it do
> something sort of reasonable with these unrelated methods. 

Danger, Will Robinson!

Tyler's right.  I'ld only add that it's sometimes impossible, because
the superclass may be binary-only.  The potential to ship binary only
superclasses seems important enough to give up only with great
trepidation.

> And a bully with a big stick.

Go Microsoft! :-)  God I *never* thought I'ld take *their* side on
*anything.*


shap