Are there any grammar for indicating "Late Static Bindings" in perl?? In php, there is. http://php.net/manual/en/language.oop5.late-static-bindings.php
I'm just looking for them for perl.
Are there any grammar for indicating "Late Static Bindings" in perl?? In php, there is. http://php.net/manual/en/language.oop5.late-static-bindings.php
I'm just looking for them for perl.
Perl doesn't have static methods, so you don't need tricks to make static methods behave like virtual methods.
package ClassA {
sub who { print __PACKAGE__, "\n" }
sub test { my ($class) = @_; $class->who(); }
}
package ClassB {
our @ISA = 'ClassA';
sub who { print __PACKAGE__, "\n" }
}
ClassA->test(); # ClassA
ClassB->test(); # ClassB