Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Creating Common Constructorby Flame (Deacon) |
on Jul 10, 2003 at 16:27 UTC ( [id://273033]=note: print w/replies, xml ) | Need Help?? |
Inheritance is another way to go.
I often use this approach when there are several attributes guaranteed to be present in all of the instances, such as the name of the creature or whatever. Also, thanks to inheritance, you can place any methods that all of these classes should support into the base class. I hope this helps, I've only been awake for... about 3 minutes now, so my interpretation of your question may be a little... off...
Edit/Note: SUPER::new is a common trick used in many object oriented languages when the parent contstructor has code to take care of a lot of the setup work. My code doesn't have bugs, it just develops random features. Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)
In Section
Seekers of Perl Wisdom
|
|