La traduction de cette page n'est pas à jour. Cliquez ici pour voir la dernière version en anglais.
Classes de type handle
Les classes peuvent supporter la sémantique de référence ou de valeur.
Créez le type de classe approprié pour votre application :
Les classes de type value vous permettent de créer de nouvelles classes de tableaux qui ont la même sémantique que les classes numériques.
Les classes de type handle définissent des objets qui font référence à
object
. La copie d’un objet crée une autre référence à ce même objet.
Pour un examen des façons d’utiliser les objets de type handle, consultez Handle Object Behavior.
Classes
handle | Superclass of all handle classes |
matlab.mixin.SetGet | Provide handle classes with set and get methods |
matlab.mixin.SetGetExactNames | Require exact name match for set and get methods |
dynamicprops | Superclass for classes that support dynamic properties |
matlab.mixin.Copyable | Superclass providing copy functionality for handle objects |
Méthodes
addlistener | Create event listener bound to event source |
listener | Create event listener without binding to event source |
notify | Notify listeners that event is occurring |
delete | Delete handle object |
findobj | Find handle objects |
findprop | Find matlab.metadata.Property object |
isvalid | Determine valid handles |
relationaloperators | Determine equality or sort handle objects |
Rubriques
Caractéristiques des classes de type handle et value
- Comparison of Handle and Value Classes
Value objects are associated with a specific variable. Handle objects can be referenced by multiple variables. - Which Kind of Class to Use
Whether you implement a handle or value class depends on what your class represents and how you want objects to behave. - Handle Object Behavior
MATLAB® handle variables support reference semantics.
Tirer parti de la classe de type handle
- The Handle Superclass
Thehandle
class implements methods to support events and listeners, destructors, relational operations, and other operations. - Handle Class Destructor
Define a delete method to customize what happens when MATLAB destroys handle objects.
Travailler avec des classes de type handle
- Find Handle Objects and Properties
Find objects using regular expressions or obtain thematlab.metadata.Property
object for specific properties. - Implement Set/Get Interface for Properties
Create a set/get interface for your handle class. - Implement Copy for Handle Classes
Customize object copy operations by deriving from thematlab.mixin.Copyable
class. - Handle Compatible Classes
Enable both handle and value classes to derive from a specific class.