Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: inheritance: constructorsby rjray (Chaplain) |
on Jun 25, 2002 at 10:05 UTC ( [id://177052]=note: print w/replies, xml ) | Need Help?? |
In Noun::new(), you need to either defer blessing or re-bless after you've invoked SUPER::new(). Unless you do, Noun::new will return instances of Word. This is not correct. The original author correctly designed the parent-class new constructor to bless based on the class it was called from-- in the case of the example above, Word::new will in fact bless the new object into the Noun class, because that is the value of $classname at that point. --rjray
In Section
Seekers of Perl Wisdom
|
|