| MATLAB® | ![]() |
| On this page… |
|---|
You can specify the relative precedence of user-defined classes using the class InferiorClasses attribute. Assign a cell array of class names (represented as metaclass objects) to this attribute to specify classes that are inferior to the class you are defining. For example, the following classdef declares that myClass is superior to class1 and class2.
classdef (InferiorClasses = {?class1,?class2}) myClass ... end
The ? operator combined with a class name creates a metaclass object. This syntax enables you to create a meta-class object without requiring you to construct an actual instance of the class.
MATLAB® built-in classes are always inferior to user-defined classes and should not be used in this list.
The built-in classes include: double, single, char, logical, int64, uint64, int32, uint32, int16, uint16, int8, uint8, cell, struct, and function_handle.
See Determining Which Method Is Invoked for more on how the MATLAB classes dispatch when evaluating expressions containing objects.
See Class Precedence and MATLAB® Path for information on how the location of a class definition on the MATLAB path determines its precedence.
See Obtaining Information About Classes with Meta-Classes for information on meta-class objects.
The inferior classes specified by the InferiorClasses attribute is inherited by subclasses. If the subclass also defines the InferiorClasses attribute, the true list of inferior classes is the union of the inferior classes defined by the subclass and all superclasses.
![]() | Organizing Classes in Directories | Scoping Classes with Packages | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |