MATLAB Object-Oriented Programming

(Joyce) #1
Use the class meta.class object to refer to classes in the access list. To specify more
than one class, use a cell array of meta.class objects. Use the package name when
referring to classes that are in packages.

NoteSpecify the meta.class objects explicitly (created with the? operator), not as
values returned by functions or other MATLAB expressions.

How MATLAB Interprets Attribute Values


  • Granting access to a list of classes restricts access to only:

    • The defining class

    • The classes in the list

    • Subclasses of the classes in the list



  • Including the defining class in the access list gives all subclasses of the defining class
    access.

  • MATLAB resolves references to classes in the access list only when the class is loaded.
    If MATLAB cannot find a class that is included in the access list, that class is
    effectively removed from access.

  • MATLAB replaces unresolved meta.class entries in the list with empty meta.class
    objects.

  • An empty access list (that is, an empty cell array) is equivalent to private access.


Specify Metaclass Objects

Generate the meta.class objects using only the? operator and the class name. Values
assigned to the attributes cannot contain any other MATLAB expressions, including
functions that return allowed attribute values:


  • meta.class objects

  • Cell arrays of meta.class objects

  • The values public, protected, or private


Specify these values explicitly, as shown in the example code in this section.

12 How to Build on Other Classes

Free download pdf