Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Re: Re: inheritance turns back and bites

by tovod-everett (Sexton)
on Mar 02, 2004 at 04:12 UTC ( #333156=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: inheritance turns back and bites
in thread inheritance turns back and bites

If your intent is to ensure that increment calls add in the same package, why not use:

sub increment { my $self = shift; &add($self, number => 1); }
Use subroutine calls when you want to create your own explicit binding, use -> notation when you desire runtime binding of the message.

Of course, it would be my opinion that it is particularly bad form for a child class to re-implement a method in a manner that is not backward compatible - it's a violation of the contract as far as I'm concerned.

--Toby Ovod-Everett


Comment on Re: Re: Re: Re: inheritance turns back and bites
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333156]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2014-08-02 00:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (53 votes), past polls