Compatibility with Previous Versions
In this section...
“New Class-Definition Syntax Introduced with MATLAB Software Version 7.6” on page 5-
59
“Changes to Class Constructors” on page 5-60
“New Features Introduced with Version 7.6” on page 5-61
“Examples of Old and New” on page 5-61
New Class-Definition Syntax Introduced with MATLAB
Software Version 7.6
MATLAB software Version 7.6 introduces a new syntax for defining classes. This new
syntax includes:
- The classdef keyword begins a block of class-definitions code. An end statement
terminates the class definition. - Within the classdef code block, properties, methods, and events are also
keywords delineating where you define the respective class members.
Cannot Mix Class Hierarchy
It is not possible to create class hierarchies that mix classes defined before Version 7.6
and current class definitions that use classdef. Therefore, you cannot subclass an old
class to create a version of the new class.
Only One “@” Class Folder per Class
For classes defined using the new classdef keyword, a class folder shadows all class
folders that occur after it on the MATLAB path. Classes defined in class folders must
locate all class files in that single folder. However, classes defined in class folders
continue to take precedence over functions and scripts having the same name, even those
functions and scripts that come before them on the path.
Private Methods
You do not need to define private folders in class folders in Version 7.6. You can set the
method's Access attribute to private instead.
Compatibility with Previous Versions