|Welcome to the Monastery|
I'm in trouble with Perl's OO programmingby cybergeek (Novice)
|on Jun 09, 2005 at 08:12 UTC||Need Help??|
cybergeek has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys, could you help me on that one : I'm using two classes, one derived from the other one. My code looks like this :* Super class (called "A") contains:
* The derived class (called "B") contains :
If I create an instance of B in a script and call $b->Schedule I get an "undefined subroutine" error for the two references corresponding to the parent's methods.
I don't know how to get a reference to a parent's method (A) from the derived class (B). One hinted me to use the can method.
More over, I have been told that using references to dynamically call methods was not the best approach. Do you have an idea about how I could do the same code while being more respectful of the object structure ?
My final aim being that the script having the B instance is able to modify the Schedule by removing, inserting, adding method calls into the Scheduler via various addTab,delTab .... methods.Thanks
** UPDATED ** The solution which consist in calling the "can" method works !