in reply to Parent cannot call Child method
It actually works the other way around. An object of the class MyParent::MyChild will be able to call methods defined in the parent, if the child does not have a method of the same name itself. So you want to try my $obj = MyParent::MyChild->new(); $obj->parent_nifty_method1();
use parent qw(Parent); already sets the @ISA of the child (and it pushes the parent in the @ISA instead of replacing it, so that a class may inherit from more than one), so you don't have to do it afterwards.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parent cannot call Child method
by TorontoJim (Beadle) on Mar 17, 2016 at 13:19 UTC | |
by jellisii2 (Hermit) on Mar 17, 2016 at 13:28 UTC | |
by TorontoJim (Beadle) on Mar 17, 2016 at 13:34 UTC | |
by Eily (Monsignor) on Mar 17, 2016 at 15:02 UTC | |
by TorontoJim (Beadle) on Mar 17, 2016 at 15:21 UTC |