nonhandle compatible class as handle-compatible by using the HandleCompatible class
attribute.
classdef (HandleCompatible) MyClass
...
end
Handle Compatibility Rules
Handle-compatible classes (that is, classes whose HandleCompatible attribute is set to
true) follow these rules:
- All superclasses of a handle-compatible class must also be handle compatible
- If a class explicitly sets its HandleCompatibility attribute to false, then none of
the class superclasses can be handle classes. - If a class does not explicitly set its HandleCompatible attribute and, if any
superclass is a handle, then all superclasses must be handle compatible. - The HandleCompatible attribute is not inherited.
A class that does not explicitly set its HandleCompatible attribute to true is:
- A handle class if any of its superclasses are handle classes
- A value class if none of the superclasses are handle classes
Identify Handle Objects
To determine if an object is a handle object, use the isa function:
isa(obj,'handle')
See Also
Related Examples
- “How to Define Handle-Compatible Classes” on page 12-41
12 How to Build on Other Classes