superiorto
Declares that a class has higher precedence than other classes.
Category: Other public functions: datatypes
Syntax
superiorto('class1', 'class2', ...)
Marks the class being defined as superior to the named classes.
Description
In a call that mixes objects of different classes, the class marked superior supplies the method that runs. superiorto registers that rule and is valid only inside a class constructor. A typical use is a user class that should take over arithmetic with double, so that obj + 1 calls the class's own plus.
inferiorto declares the reverse relation.
Input arguments
'class1', ...- Names of classes, as text.
Example
Outside a class method
try
superiorto('double')
catch err
disp(err.message)
end
Output
Function 'SUPERIORTO' can only be called from within a method.
A script is not a class constructor, so the call is rejected.
Notes
This is the old-style class mechanism; in a script it always raises an error.