Each subclass in the heterogeneous hierarchy implements a concrete version of the
abstract method. The concrete method provides specialized behavior required by the
particular subclass.
The Printable class shows how to implement a template method approach:
classdef (HandleCompatible) Printable
methods(Sealed)
function print(aryIn)
n = numel(aryIn);
for k=1:n
printElement(aryIn(k));
end
end
end
methods(Access=protected, Abstract)
printElement(objIn)
end
end
See Also
Related Examples
- “Handle Compatible Classes” on page 12-39
See Also