Is it possible to make Matlab to call a copy
method of my class TMyClass
(which is a handle
calss) when an object of this class is assigned to a variable. In other words, I want my handle
class to behave as a value class when copying it:
obj = TMyClass(); %// has method "copy", which returns a deep copy of the object
%// Now, if I write this ...
obj_copy = obj;
%// ... I want Matlab to do in fact this:
obj_copy = obj.copy; %//
As I understood, there is no way to override the =
operator in Matlab. Is there any other workaround to do so?
Thanks!