MATLAB Object-Oriented Programming

(Joyce) #1

Assets Class


The Assets class:



  • Derives directly from matlab.mixin.Heterogeneous

  • Is the root of the heterogeneous hierarchy

  • Is abstract

  • Is the class of heterogeneous arrays composed of any mixture of Stock, Bond, and
    Cash objects


Properties


The Assets class defines two properties:



  • Description — A general description of the individual asset constrained to be of
    class char.

  • Type — The type of asset defined as an abstract property that each subclass
    implements.


Methods


The Assets class defines these methods:



  • pie — A sealed method that creates a pie chart showing the relative mix of asset
    types.

  • makeReport — A sealed method that creates a report listing the assets.

  • getCurrentValue — An abstract method that each concrete subclass must
    implement to return the current value of the asset.

  • getDefaultScalarElement — matlab.mixin.Heterogeneous class method
    overridden in the Assets class to specify a default object. The Assets class is
    abstract so it cannot be used as the default object. For more information, see “Default
    Object” on page 20-12.


Methods in Heterogeneous Hierarchies


Methods defined by the Assets class are either:



  • Concrete methods (fully implemented) that subclasses do not override

  • Abstract methods (signatures only) that subclasses implement


A Class Hierarchy for Heterogeneous Arrays
Free download pdf