| MATLAB® | ![]() |
inferiorto('class1','class2',...)
The inferiorto function establishes a precedence that determines which object method is called.
Note You can use this function only from a constructor that calls the class function to create an object, which was the only way to create MATLAB classes prior to MATLAB Version 7.6. |
inferiorto('class1','class2',...) invoked within a class constructor method, establishes that class as having lower precedence than the classes in the function argument list for purposes of function dispatching (i.e., which method or function is called in any given situation).
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'. Also suppose the constructor method of class_c.m contains the statement:
inferiorto('class_a')This 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 a function is called with two objects having an unspecified relationship, the two objects have equal precedence, and the left-most object's method is called. So fun(b, c) calls class_b/fun, while fun(c, b) calls class_c/fun.
See Object-Oriented Programming for information on the creating MATLAB classes.
See Object Precedence in Expressions Using Operators
![]() | Inf | info | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |