MATLAB Object-Oriented Programming

(Joyce) #1

When you access a property, MATLAB executes any property set or get access method
and triggering any enabled property events.


Inheritance of Properties


When you derive one class from another class, the derived (subclass) class inherits all the
properties of the superclass. In general, subclasses define only properties that are unique
to that particular class. Superclasses define properties that more than one subclass use.


Specify Property Attributes


Attributes specified with the properties keyword apply to all property definitions that
follow in that block. If you want to apply attribute settings to certain properties only,
reuse the properties keyword and create another property block for those properties.


For example, the following code shows the SetAccess attribute set to private for the
IndependentVar and Order properties, but not for the Coefficients property:


properties
Coefficients = [0 0 1];
end
properties (SetAccess = private)
IndependentVar
Order = 0
end

These properties (and any others placed in
this block) have private set access

For information about the properties of a specific class, use the properties function.


See Also


Related Examples



  • “Validate Property Values” on page 8-24


See Also
Free download pdf