Vous suivez désormais cette soumission
- Les mises à jour seront visibles dans votre flux de contenu suivi
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails
The motivation for this demo is that if you have an instance (say 'a') of a custom class that subclasses 'handle', then the command 'b = a;' will produce another reference 'b' to the same object as initially referenced by 'a', effectively creating a 'shallow' copy of the object.
The link to this demo contains a test class which contains the code necessary to produce a clone or 'deep' copy of its instance by way of a method and alternatively, through its constructor.
A test script is provided to demonstrate the cloning of instances of the test class.
Written by Sam Oliver & Bobby Nedelkovski
The MathWorks Australia Pty Ltd
Copyright 2009, The MathWorks, Inc.
Citation pour cette source
Bobby Nedelkovski (2026). Clone Handle Object - using MATLAB OOP (https://fr.mathworks.com/matlabcentral/fileexchange/22965-clone-handle-object-using-matlab-oop), MATLAB Central File Exchange. Extrait(e) le .
Remerciements
A inspiré : Copy / Clone method for handle and hgsetget class
Informations générales
- Version 1.2.0.1 (4,95 ko)
Compatibilité avec les versions de MATLAB
- Compatible avec toutes les versions
Plateformes compatibles
- Windows
- macOS
- Linux
| Version | Publié le | Notes de version | Action |
|---|---|---|---|
| 1.2.0.1 | Updated license |
||
| 1.2.0.0 | Added copyright protection to Description field and associated files . Verified this item works with MATLAB R2009b. |
||
| 1.1.0.0 | This demo has been updated to use Dynamic Expressions when copying properties of an object. |
||
| 1.0.0.0 |
