SPUG: Unidentified Flying Objects

Jeff Almeida spud at spudzeppelin.com
Tue Jan 10 13:07:01 PST 2006

On Jan 10, 2006, at 2:25 PM, Andrew Sweger wrote:

> Somehow it seems to defeat the purpose of the academic OO model. But
> that's just because I can't think of a practical example of where this
> technique would actually be helpful to understanding the solution to a
> problem.

Think about the classic textbook example for multiple inheritance: a  
flying boat
is both a boat and an airplane.  But really, it doesn't act like both  
of them at the
same time... this way, it's a boat when it's a boat and it's and  
airplane when it's
an airplane.

Or, as a second suggestion, certain professional athletes might have  
two (or
more!) sets of statistics, based on which sport they happened to be  
playing at
the time: Bo Jackson, Deion Sanders, Michael Jordan, and Danny Ainge all
leap to mind right away....

My main question is how you keep track of whether an object can  
change its
base class -- do you add some attribute common to a superclass that  
all of the possible classes something could become, itemizing which  
ones it may
become?  Or, is this whole proposition just a loosely-camouflaged  
form of
multiple inheritance that reorders the inheritance hierarchy on the fly?

And how in the world did you get warmer weather today than we did?  

Jeff D. Almeida * Corinth, TX
spud at spudzeppelin.com

More information about the spug-list mailing list