SPUG: Unidentified Flying Objects

Uri London uril at exchange.microsoft.com
Tue Jan 10 20:09:19 PST 2006

In C++:

You can somewhat hack it, but changing the __vptr (typically the first pointer in a class) of one object, to point to a different __vtable.

-----Original Message-----
From: spug-list-bounces at pm.org [mailto:spug-list-bounces at pm.org] On Behalf Of Jeff Almeida
Sent: Tuesday, January 10, 2006 1:07 PM
To: Andrew Sweger
Cc: Fred Morris; spug-list at pm.org
Subject: Re: SPUG: Unidentified Flying Objects

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

Seattle Perl Users Group Mailing List  
     POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
    MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
    WEB PAGE: http://seattleperl.org/

More information about the spug-list mailing list