MATLAB Object-Oriented Programming

(Joyce) #1

Property Added


The ExtendDouble class defines the DataString property to contain text that describes
the data. The superclass part of the class contains the numeric data.


Methods Implemented


The following methods modify the behavior of the ExtendDouble class:



  • ExtendDouble — The constructor supports a no argument syntax that initializes
    properties to empty values.

  • subsref — Enables subscripted reference to the superclass part of the subclass, dot
    notation reference to the DataString property, and dot notation reference the built-
    in data via the name Data.

  • subsasgn — Enables subscripted assignment to the superclass part of the subclass,
    dot notation reference to the DataString property, and dot notation reference the
    built-in data via the name Data.

  • horzcat — Defines horizontal concatenation of ExtendDouble objects. concatenates
    the superclass part using the double class horzcat method and forms a cell array of
    the DataString properties.

  • vertcat — The vertical concatenation equivalent of horzcat (both are required).

  • char — A ExtendDouble to char converter used by horzcat and vertcat.

  • disp — ExtendDouble implements a disp method to provide a custom display for
    the object.


Class Definition Code


The ExtendDouble class extends double and implements methods to support
subscripted indexing and concatenation.


classdef ExtendDouble < double


properties
DataString
end


methods
function obj = ExtendDouble(data,str)
if nargin == 0


Subclasses of Built-In Types with Properties
Free download pdf