Programming |
Specifying Precedence of User-Defined Classes
You can specify the relative precedence of user-defined classes by calling the inferiorto
or superiorto
function in the class constructor.
The inferiorto
function places a class below other classes in the precedence hierarchy. The calling syntax for the inferiorto
function is
You can specify multiple classes in the argument list, placing the class below many other classes in the hierarchy.
Similarly, the superiorto
function places a class above other classes in the precedence hierarchy. The calling syntax for the superiorto
function is
Location in the Hierarchy
If objectA
is above objectB
in the precedence hierarchy, then the expression
calls @
classA
/plus.m
. Conversely, if objectB
is above objectA
in the precedence hierarchy, then MATLAB calls @
classB
/plus.m
.
See How MATLAB Determines Which Method to Call for related information.
Object Precedence | How MATLAB Determines Which Method to Call |
© 1994-2005 The MathWorks, Inc.