in reply to Re: perl inheritance
in thread perl inheritance
I'm not sure exactly how I should do that. Would you have the constructor take a base class object and convert it to the derived? Something like the following:
Would invoking this form of the derived class constructor through AUTOLOAD be considered bad practice? This is so that all base class methods do not have to be overridden?sub new { if (ref $class eq 'base') { //return derived object built from base class object } //return derived object built from parameters }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl inheritance
by chromatic (Archbishop) on Mar 23, 2012 at 22:02 UTC | |
by Anonymous Monk on Mar 26, 2012 at 14:07 UTC | |
by chromatic (Archbishop) on Mar 27, 2012 at 16:19 UTC | |
by Anonymous Monk on Mar 29, 2012 at 15:39 UTC | |
by tangent (Parson) on Mar 29, 2012 at 16:11 UTC | |
by Anonymous Monk on Mar 29, 2012 at 14:43 UTC |