Because there isn't a new() method in the Foo::Bar class, it will use the new() method in its parent class, which is Foo. Because Foo's new() method uses the $class that was passed into new() (which is Foo::Bar), it will DWIM.package Foo; sub new { my $class = shift; return bless {}, $class; } package Foo::Bar; use base 'Foo'; package main; use Foo::Bar; my $foobar = Foo::Bar->new;
In reply to Re^5: Objects and references
by dragonchild
in thread Objects and references
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |