|Just another Perl shrine|
OO - problem with inheritanceby uwevoelker (Pilgrim)
|on Jan 14, 2002 at 19:38 UTC||Need Help??|
uwevoelker has asked for the wisdom of the Perl Monks concerning the following question:
I'm having a great problem with inheritance. I would like to build a generic datatype class and inherit other classes from this base class.
Here is a shortened version of the base class:
In the Integer class I use
to enable the parameter 'mandatory'. I have written a test suite and it works. But when I use another datatype (String) and do the same with other parameters, they both use the same variables from the base class.
I would like to give every datatype his own $parameter_config, but they only write at startup time in this hashref, the constructor new() deals with this hashref. And this new() is inherited from base_class.pm.
They should not use all the same variable $parameter_config, every class (Integer/String and so on) should have their own, but the access is only in the subroutine &base_class::new(). No inherited datatype has its own constructor.
I hope you have understood me, if not I would like to clarify. Feel free to ask. Hopefully you can help me. Thanks a lot.
Good bye, uwe