in reply to Re: Inheritance in Perl5
in thread Inheritance in Perl5
With that said, I think there is something seriously wrong if you want your subclass to confirm that it inherits from the parent class in a method ;)package Animal; use Moose; has [qw/name age/] => ( isa => 'Str', is => 'rw' ); package Horse; use Moose; extends 'Animal'; sub present { my $self = shift; print $self->isa('Animal') ? "I am an animal" : "I am not animal" }
|
|---|