superiorto - Establish superior class relationship

Syntax

superiorto('class1', 'class2', ...)

Description

The superiorto function establishes a precedence that determines which object method is called.

See MATLAB® Classes and Object-Oriented Programming for information on the creating MATLAB classes.

superiorto('class1', 'class2', ...) invoked within a class constructor method, establishes that class as having precedence over the classes in the function argument list for purposes of function dispatching (i.e., which method or function is called in any given situation).

Remarks

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 for class_c.m 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 a function is called with two objects having an unspecified relationship, the two objects are considered to 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 Also

inferiorto

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS