|Programming and Data Types|
Designing the Stock Class
A stock object is designed to represent one particular asset in a person's investment portfolio. This object contains two properties of its own and inherits three properties from its parent asset object.
NumberShares- The number of shares for the particular stock object.
SharePrice- The value of each share.
Descriptor- The identifier of the particular asset (e.g., stock name, savings account number, etc.).
Date- The date the object was created (calculated by the
CurrentValue- The current value of the asset.
Note that the property names are not actually the same as the field names of the structure array used internally by stock and asset objects. The property name interface is controlled by the stock and asset
get methods and is designed to resemble the interface of other MATLAB object properties.
asset field in the stock object structure contains the parent asset object and is used to access the inherited fields in the parent structure.
Stock Class Methods
The stock class implements the following methods:
|The Asset fieldcount Method||The Stock Constructor Method|