LesleyB has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Oh Great Ones
I have been studying perltoot and noticed something I'd like to be sure about.
Inherited Autoloaded Data Methods shows an Employee package inheriting from a Person package, where that package has autoloaded data methods. Note carefully the Employee constructor does not bless $self into the Employee class.
At the end of Overridden Methods, just before Multiple Inheritance, the Employee constructor reconsecrates $self into the Employee class.
Having cut and pasted the code and constructed empty subclass tests, empirically at least, both constructors work.
I constructed the argument that the Employee class is sent into the Person class and therefore blessing in the Person package actually blesses the Person object into the Employee class, so the the $self returned from the inherited constructor is already in the Employee class. Therefore one might add to $self as demonstrated in the subclass constructor.
Which then left the dangling question on the purpose of the earlier example of reconsecration. I can only offer that it allows a subsequent class to be subclassed to the Employee class.
Are these two arguments reasonable?
Many thanks in advance for your replies
Regards
L.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To bless or not to bless
by jettero (Monsignor) on Nov 30, 2009 at 14:42 UTC | |
|
Re: To bless or not to bless
by Arunbear (Prior) on Nov 30, 2009 at 17:24 UTC | |
by ikegami (Patriarch) on Nov 30, 2009 at 18:25 UTC | |
by LesleyB (Friar) on Nov 30, 2009 at 19:23 UTC | |
by ikegami (Patriarch) on Nov 30, 2009 at 20:55 UTC | |
by LesleyB (Friar) on Nov 30, 2009 at 17:38 UTC |