MATLAB Object-Oriented Programming

(Joyce) #1

Method Naming


The name of a function that implements a method can contain dots (for example,
set.PropertyName) only if the method is one of the following:


  • Property set/get access method (see “Property Access Methods” on page 8-50)

  • Conversion method that converts to a package-qualified class, which requires the use
    of the package name (see “Packages Create Namespaces” on page 6-25)


You cannot define property access or conversion methods as local functions, nested
functions, or separately in their own files. Class constructors and package-scoped
functions must use the unqualified name in the function definition; do not include the
package name in the function definition statement.

See Also


Related Examples



  • “Method Attributes” on page 9-5

  • “Rules for Naming to Avoid Conflicts” on page 9-36


9 Methods — Defining Class Operations

Free download pdf