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.
In reply to To bless or not to bless by LesleyB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |