Next | Tricks of the Wizards | 142 |
Argument 1 is always an object of the appropriate class, as with any method
On two objects of the same type, you get the objects in the same order:
$obj1 - $obj2 mysubtract($obj1, $obj2); $obj2 - $obj1 mysubtract($obj2, $obj1);
When operating on an overloaded object and an unoverloaded value, the object is always the first argument:
$obj1 - $x mysubtract($obj1, $x); $x - $obj1 mysubtract($obj1, $x, 1);
On two overloaded objects of different types, the left-hand argument determines whose method will be called:
$obj1 - $OBJX mysubtract($obj1, $OBJX); $OBJX - $obj1 Xcombine($OBJX, $obj1);
Next | Copyright © 2003 M. J. Dominus |