Method Attributes
Purpose of Method Attributes
Specifying attributes in the class definition enables you to customize the behavior of methods for specific purposes. Control characteristics like access, visibility, and implementation by setting method attributes. Subclasses do not inherit superclass member attributes.
Specifying Method Attributes
Assign method attributes on the same line as the methods
keyword:
methods (Attribute1 = value1, Attribute2 = value2,...) ... end
Table of Method Attributes
Attributes enable you to modify the behavior of methods. All methods support the attributes listed in the following table.
Attribute values apply to all methods defined within the methods...end
code block that specifies the nondefault values.
Method Attributes
Attribute Name | Class | Description |
---|---|---|
Abstract |
| If
|
|
| Determines what code can call this method:
|
|
| When |
Sealed |
| If true , the method cannot be redefined in a subclass. Attempting to define a method with the same name in a subclass causes an error. |
|
| Specify as Static Methods provides more information. |
Framework attributes | Classes that use certain framework base classes have framework-specific attributes. See the documentation for the specific base class you are using for information on these attributes. |
See Also
metaclass
| matlab.metadata.Method