We don't bite newbies here... much | |
PerlMonks |
Re^2: Tutorial: Introduction to Object-Oriented Programmingby adrianh (Chancellor) |
on Dec 13, 2002 at 12:27 UTC ( [id://219566]=note: print w/replies, xml ) | Need Help?? |
Your right - forgotten about that. You still have the problem of overloading tho - what if a subclass overloads "+"? Unfortunately, there isn't an overload::NumVal to match overload::StrVal (unless I'm missing something somewhere ;-) You can get around this by blessing the object into another class you know isn't overloaded, get the numeric ID, and then bless the object back into it's original class. For example:
Mildly evil - but seems to work.
In Section
Meditations
|
|