Inheritance Problem in Perl OOP
- by Sam
Hello,
I have a sub class that calls a method from a super class. and the method in the super class use a method that is defined in the super class as asbstract(not really abstract) but implemented in the sub class.
for example:
package BaseClass;
sub new
{
}
sub method1 {
return someAbstractMethod();
}
sub someAbtsractMethod
{
die "oops, this is an abstract method that should be implemented in a subclass" ;
}
1;
package SubClass;
sub new
{
}
sub someAbtsractMethod
{
print "now we implement the asbtract method";
}
1;
now when I do:
$sub = new SubClass();
$sub-method1();
It calls the abstract message and i get the specified error message. if I took off the abstractmethod from the super class and just leave the implementation in the subclass, It does not recognize the method and I get subroutine abstractmethod not found error.