XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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, s-t In reply to OO: sharing data across inheritance by skillet-thief
|
|