| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
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 Specifying 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.
![]() | superclasses | support | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |