|We don't bite newbies here... much|
OO: sharing data across inheritanceby skillet-thief (Friar)
|on Jun 02, 2004 at 09:53 UTC||Need Help??|
skillet-thief has asked for the wisdom of the Perl Monks concerning the following question:
I'm am still working on my comprehension of OO in Perl. I think I more or less grasp the general ideas but am having some trouble with the more practical applications.
Here is my current problem. I want to have a Parent class that has a new_child() method that blesses a new objet into the Child class that inherits from Parent. That should give me something like this, in the script that uses these modules:
I would like to have param1, for example, be available to $c. Do I need to copy it explicitly in the constructor, by doing something like this in Parent.pm? (I know this would work, but I'm not sure that it is the best way to acheive what I want.)
Or is there some way for $c to refer to what is in $p?
Or am I hopelessly off target on this whole thing?
Thanks and cheers,