You can use SUPER keyword to call your parent class members. Find below code for your reference
use strict; use warnings; { package Level1; sub new { bless {}, shift }; sub display { print "Base\n" } } { package Level2; use base qw(Level1); sub display { my($class) = @_; $class->SUPER::display(); } } { package Level3; use base qw(Level2); sub display { my($class) = @_; $class->SUPER::display(); } } { package Level4; use base qw(Level3); sub display { my($class) = @_; $class->SUPER::display(); } } my $obj = Level4->new(); $obj->display();
In reply to Re: how to get the parent class method of the parent class itself
by leslie
in thread how to get the parent class method of the parent class itself
by ghosh123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |