I would have expected that an instance of the base class would have been returned.You should read more on Object Oriented Programming. This is not how inheritance works. Try this:
{ package MyBase; sub new { my $class = shift; warn "Constructing $class\n"; bless {}, $class; } } { package MyChild; use base 'MyBase'; } package main; use feature 'say'; my $p = MyBase->new; my $ch = MyChild->new; say for $p, $ch;
Updated: MyBase quoted in "use base".
In reply to Re^3: Error: Can't use string as a hash ref
by choroba
in thread Error: Can't use string as a hash ref
by Nocturnus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |