No such thing as a small change | |
PerlMonks |
Re: Simple inheritance questionby ikegami (Patriarch) |
on Apr 23, 2010 at 16:51 UTC ( [id://836563]=note: print w/replies, xml ) | Need Help?? |
Perl has no idea it's suppose to call test as a method. The only difference between a function and a method is how the sub is called, or rather, how it expects to be called.
Non-virtual instance methods can be approximated using
I say "approximate", since it's doesn't check inheritance. And there's also this syntax:
In this case, all of the following work:
Only the first really makes sense, though. And maybe the second one if you don't want test to be overridden by a child class of Two.
In Section
Seekers of Perl Wisdom
|
|