[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] $self->SUPER::methodA();
> if a class(CB) has methodA and the ISA (CA) has methodA, can
CB->methodA run and then call CA->methodA? Is that the SUPER:: notation?
Yup.
$ cat j.pl
package CA;
sub methodA {
print "Hi. I'm the super/base/parent class.\n";
}
package CB;
use vars qw(@ISA);
@ISA = qw( CA );
sub new { return bless {}; }
sub methodA {
my ($self) = @_;
print "Hi. I'm the sub/derived/child class.\n";
$self->SUPER::methodA();
}
package main;
my $obj = CB->new();
$obj->methodA;
$ perl j.pl
Hi. I'm the sub/derived/child class.
Hi. I'm the super/base/parent class.