MATLAB Function Reference |
Establish superior class relationship
Syntax
Description
The superiorto
function establishes a hierarchy that determines the order in which MATLAB calls object methods.
superiorto('class1', 'class2', ...)
invoked within a class constructor method (say myclass.m
) indicates that myclass
's method should be invoked if a function is called with an object of class myclass
and one or more objects of class class1
, class2
, and so on.
Remarks
Suppose A
is of class 'class_a'
, B
is of class 'class_b'
and C
is of class 'class_c'
. Also suppose the constructor class_c.m
contains the statement superiorto('class_a')
. Then e = fun(a,c)
or e = fun(c,a)
invokes class_c/fun
.
If a function is called with two objects having an unspecified relationship, the two objects are considered to have equal precedence, and the leftmost object's method is called. So fun(b,c)
calls class_b/fun
, while fun(c,b)
calls class_c/fun
.
See Also
sum | support |
© 1994-2005 The MathWorks, Inc.