MATLAB Object-Oriented Programming
Default Object A default object is the object returned by calling the class constructor with no arguments. MATLAB uses default o ...
Heterogeneous hierarchies enable you to define the default object for that hierarchy. The matlab.mixin.Heterogeneous class provi ...
See Also Related Examples “A Class Hierarchy for Heterogeneous Arrays” on page 20-2 “Handle-Compatible Classes and Heterogeneou ...
Heterogeneous Array Constructors In this section... “Building Arrays in Superclass Constructors” on page 10-34 “When Errors Can ...
that is called by the subclass constructor. Therefore, building an array in the superclass constructor can create a heterogeneou ...
Sample Implementation The following class hierarchy defines a subclass that builds object arrays in its constructor. The root su ...
The TeamMembers class is the root of the heterogeneous hierarchy and is a concrete class. Before assigning values to the Name an ...
end end end end The ProjectEngineer class requires a cell array of names, a numeric array of phone extensions, and a cell array ...
See Also More About “Designing Heterogeneous Class Hierarchies” on page 10-24 See Also ...
...
Events — Sending and Responding to Messages “Overview Events and Listeners” on page 11-2 “Define Custom Event Data” on page 11- ...
Overview Events and Listeners In this section... “Why Use Events and Listeners” on page 11-2 “Events and Listeners Basics” on pa ...
Listener callback functions must define at least two input arguments — the event source object handle and the event data (See “ ...
function anyMethod(obj) ... notify(obj,'EventName'); end end end Any function or method can trigger the event for a specific ins ...
SourceOfEvent — An object of the class that defines the event. The event is triggered on this object. EventName — The name of t ...
Define Custom Event Data In this section... “Class Event Data Requirements” on page 11-6 “Define and Trigger Event” on page 11-6 ...
Saves the original property value Sets the property to the specified value If the specified value is greater than 10, the set m ...
Create Listener for Overflow Event To listen for the Overflow event, attach a listener to an instance of the SimpleEventClass cl ...
Observe Changes to Property Values This example shows how to listen for changes to a property value. This example uses: PostSet ...
Use the PropLis class by creating an instance and calling its attachListener method: plObj = PropLis; plObj.ObservedProp ans = 1 ...
«
17
18
19
20
21
22
23
24
25
26
»
Free download pdf