Specify inferior class relationship




inferiorto('class1','class2',...) establishes that the class invoking this function in its constructor has lower precedence than the classes in the argument list. MATLAB® uses this precedence to determines which method or function MATLAB calls in any given situation.

Use this function only from a constructor that calls the class function to create objects (classes defined before MATLAB 7.6).


Specify class precedence.

Suppose a is an object of class class_a, b is an object of class class_b, and c is an object of class class_c. Suppose the constructor method of class_c contains the statement:


This function call establishes class_a as taking precedence over class_c for function dispatching. Therefore, either of the following two statements:

e = fun(a,c);
e = fun(c,a);

Invoke class_a/fun.

If you call a function with two objects having an unspecified relationship, the two objects have equal precedence. In this case, MATLAB calls the method of the left-most object. So fun(b, c) calls class_b/fun, while fun(c, b) calls class_c/fun.

See Also

Introduced before R2006a

Was this topic helpful?