in reply to Inheritance in Perl5
The other comments are wrong; the problem is that the assignment to @Horse::ISA occurs after the creation of the $horse1 object and subsequent method calls. Put a BEGIN block around our @ISA=("Animal"); and your code will work.
If Perl 5 had a declarative class syntax where subclassing relationships happened at compilation time, this would not be a problem.
|
|---|