Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Classdef Block

Specifying Attributes and Superclasses

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

  • Class attributes

  • Superclasses

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.

Was this topic helpful?