| MATLAB® | ![]() |
| On this page… |
|---|
A MATLAB® class definition is a template whose purpose is to provide a description of all the elements that are common to all instances of the class. Class members are the properties, methods, and events that define the class.
MATLAB classes are defined in code blocks, with sub-blocks delineating the definitions of various class members. See classdef Syntax for details on the classdef block.
Attributes modify the behavior of classes and the members defined in the class-definition block. For example, you can specify that methods are static or that properties are abstract, and so on. The following sections describe these attributes:
Class definitions can provide information, such as inheritance relationships or the names of class members without actually constructing the class. See Obtaining Information About Classes with Meta-Classes.
See Specifying Attributes for more on attribute syntax.
There are two kinds of MATLAB classes—handle and value classes.
Handle classes create objects that reference the data contained. Copies refer to the same data.
Value classes make copies of the data whenever the object is copied or passed to a function. MATLAB numeric types are value classes.
See Comparing Handle and Value Classes for a more complete discussion.
For more information on how to define class hierarchies, see Building on Other Classes .
![]() | Working with Classes | Defining Classes — Syntax | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |