![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: Change the parent of an instanceby perrin (Chancellor) |
on May 11, 2004 at 18:29 UTC ( #352531=note: print w/replies, xml ) | Need Help?? |
Whoa, bad idea. You should re-think your model so that you are changing properties, not identity, and make your code handle multiple types of objects that implement the same interface (polymorphism). For example, add a "is_carryable" method to all of your classes, with an implementation for the Foe class like this:
In Section
Seekers of Perl Wisdom
|
|