inferiorto - Specify inferior class relationship

Syntax

inferiorto('class1','class2',...)

Description

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

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).

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 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 Also

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

See Object Precedence in Expressions Using Operators

superiorto

  


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