On Tue, Oct 01, 2002 at 03:43:22PM -0400, Trey Harris wrote:
> You want something like
> 
>   class Car is Vehicle renames(drive => accel)
>             is MP3_Player renames(drive => mp3_drive);
> 
> Either of those renamings is, of course, optional, in which case drive()
> refers to the non-renamed one when referring to a Car object.
> 
> But later on, if some code does
> 
>   Vehicle $mover = getNext(); # returns a Car
>   $mover.drive(5);
> 
> It should call C<Vehicle::drive()> on C<$mover>, that is,
> C<$mover.accel()>.
> 
> See why aliasing doesn't solve this?

Ahh, because Perl has to know that when $mover is used as a Vehicle it
uses Car.accel but when used as an MP3_Player it calls Car.mp3_drive.
Clever!


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
If I got something to say, I'll say it with lead.
    -- Jon Wayne

Reply via email to