Programming |
The Asset fieldcount Method
The asset fieldcount
method returns the number of fields in the asset object data structure. fieldcount
enables asset child methods to determine the number of fields in the asset object during execution, rather than requiring the child methods to have knowledge of the asset class. This allows you to make changes to the number of fields in the asset class data structure without having to change child-class methods.
function numFields = fieldcount(assetObj) % Determines the number of fields in an asset object % Used by asset child class methods numFields = length(fieldnames(assetObj));
The struct
function converts an object to its equivalent data structure, enabling access to the structure's contents.
The Asset display Method | Designing the Stock Class |
© 1994-2005 The MathWorks, Inc.