MATLAB Object-Oriented Programming

(Joyce) #1

See “Class Attributes” on page 6-6 for a list of attributes and a discussion of the
behaviors they control.


Superclass Syntax


Derive a class from one or more other classes by specifying the superclasses on the
classdef line:


classdef ClassName < SuperclassName
...
end


For example, the LinkedList class inherits from classes called Array and handle:


classdef LinkedList < Array & handle
...
end


Local Functions in Class File


You can define only one class per file. However, you can add local functions to a file
containing the classdef block. Local functions are scoped to the classdef file and
have access to private and protected class members.


classdef ClassName
...
end
function localFunction
...
end


See Also


Related Examples



  • “User-Defined Classes” on page 6-2

  • “Design Subclass Constructors” on page 12-9

  • “Local Functions”


See Also
Free download pdf