| Contents | Index |
superiorto('class1', 'class2', ...)
superiorto('class1', 'class2', ...) establishes that the class invoking this function in its constructor has higher precedence than the classes in the argument list.
The superiorto function establishes a precedence that determines which object method MATLAB calls. Use this function only from a constructor that calls the class function to create an object. For classes defined with classdef statements, see Class Precedence.
Show function dispatching:
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. The constructor method for class_c contains the statement superiorto('class_a'). Then, either of the following two statements:
e = fun(a,c); e = fun(c,a);
invokes class_c/fun.
If you call a function with two objects having an unspecified relationship, MATLAB considers the two objects to have equal precedence. In this case, MATLAB calls the left-most object method. So fun(b,c) calls class_b/fun, while fun(c,b) calls class_c/fun.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |