Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

The Classdef Block

Specifying Attributes and Superclasses

The classdef block contains the class definition. The classdef line is where you specify:

The classdef block contains the properties, methods, and events subblocks.

Assigning Class Attributes

Class attributes modify class behavior in some way. Assign values to class attributes only when you want to change their default value.

No change to default attribute values:

classdef class_name
   ...
end

One or more attribute values assigned:

classdef (attribute1 = value,...)
   ...
end

See Class Attributes for a list of attributes and a discussion of the behaviors they control.

Specifying Superclasses

To define a class in terms of one or more other classes by specifying the superclasses on the classdef line:

classdef class_name < superclass_name
   ...
end

See Creating Subclasses — Syntax and Techniques for more information.

  


Recommended Products

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