- It is a handle class (it derives from handle).
- All its superclasses are handle compatible (handle classes are handle compatible by
definition).
classdef HPropertyDefaults < handle & Utility
properties
GraphPrim = line
Width = 1.5
Color = 'black'
end
endThe HPropertyDefaults class is handle compatible:hpd = HPropertyDefaults;
mc = metaclass(hpd);
mc.HandleCompatibleans =1Nonhandle Subclasses of a Handle-Compatible ClassIf you subclass both a value class that is not handle compatible and a handle compatible
class, the subclass is a nonhandle compatible value class. The ValueSub class:- Is a value class (it does not derive from handle.)
- One of its superclasses is handle compatible (the Utility class).
classdef ValueSub < MException & Utility
methods
function obj = ValueSub(str1,str2)
obj = obj@MException(str1,str2);
end
end
endThe ValueSub class is a nonhandle-compatible value class because the MException
class does not define the HandleCompatible attribute as true:hv = ValueSub('MATLAB:narginchk:notEnoughInputs',...
'Not enough input arguments.');
mc = metaclass(hv);
mc.HandleCompatible12 How to Build on Other Classes