MATLAB Object-Oriented Programming

(Joyce) #1
disp@Asset(s) % Call base class disp method first
fprintf(1,'Number of shares: %g\nShare price: %3.2f\n',...
s.NumShares,s.SharePrice);
end % disp
end
end

Limitations of Use

The following restrictions apply to calling superclass methods. You can use this notation
only within:


  • A method having the same name as the superclass method you are invoking

  • A class that is a subclass of the superclass whose method you are invoking


Invoking Built-In Functions


The MATLAB builtin function enables you to call the built-in version of a function that
has been overloaded by a method.

See Also


More About



  • “Object Precedence in Method Invocation” on page 9-47

  • “Class Precedence” on page 6-23


9 Methods — Defining Class Operations

Free download pdf