How to find out if a class is a handle class?

17 vues (au cours des 30 derniers jours)
broken_arrow
broken_arrow le 12 Mar 2023
Modifié(e) : Matt J le 15 Mar 2023
How can I find out if a class is a handle or a value class? Unfortunately I can't seem to figure it out. Take e. g. matlab.mixin.CustomDisplay. The documentation only says it's handle compatible, but not if it is itself a handle class. I need a class that inherits from handle and matlab.mixin.CustomDisplay. So if the latter is itself a handle class, inheriting from handle would be redundant, right?

Réponse acceptée

Matt J
Matt J le 12 Mar 2023
Modifié(e) : Matt J le 15 Mar 2023
How can I find out if a class is a handle or a value class?
You can use,
isa(obj,'handle')
I need a class that inherits from handle and matlab.mixin.CustomDisplay. So if the latter is itself a handle class, inheriting from handle would be redundant, right?
It would be redundant to inherit both from handle and one of its subclasses. However matlab.mixin.CustomDisplay is not a subclass of handle, so it is not redundant in that case.
  1 commentaire
broken_arrow
broken_arrow le 15 Mar 2023
Ah, ok. So that's the way it's done. Thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by