oop: how to switch between passing by reference and value
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
i've a class that inherits the "handle" class, objects therefore always passed by reference. But now I want to copy an array of objects of this class such that i can modify the original and the copy seperately. Is there any easy way to be able to decide between copying and object and passing it by reference?
Thank you!
0 个评论
采纳的回答
Daniel Shub
2013-4-25
The documentation is pretty sparse, but also there: http://www.mathworks.co.uk/help/matlab/matlab_prog/copying-objects.html#brultwv
Copy Method for Handle Classes
Handle classes can derive copy functionality from the matlab.mixin.Copyable class. Class designers should investigate the use of this class in their class hierarchy design
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!