Programming |
The Asset set Method
The asset class set
method is called by subclass set
methods. This method accepts an asset object and variable length argument list of property name/property value pairs and returns the modified object.
function a = set(a,varargin) % SET Set asset properties and return the updated object propertyArgIn = varargin; while length(propertyArgIn) >= 2, prop = propertyArgIn{1}; val = propertyArgIn{2}; propertyArgIn = propertyArgIn(3:end); switch prop case 'Descriptor' a.descriptor = val; case 'Date' a.date = val; case 'CurrentValue' a.currentValue = val; otherwise error('Asset properties: Descriptor, Date, CurrentValue') end end
Subclass set
methods call the asset set
method and require the capability to return the modified object since MATLAB does not support passing arguments by reference. See The Stock set Method for an example.
The Asset get Method | The Asset subsref Method |
© 1994-2005 The MathWorks, Inc.