function obj = SimpleHandleClass(c)
if nargin > 0
obj.Color = c;
end
end
end
endCreate an instance of SimpleHandleClass, assigning a value of red to its Color
property:obj = SimpleHandleClass('red');Pass the object to the function g, which assigns blue to the Color property:y = g(obj);The function g sets the Color property of the object referred to by both the returned
handle and the original handle:y.Colorans =blueobj.Colorans =blueThe variables y and obj refer to the same object:y.Color = 'yellow';
obj.Colorans =yellowThe function g modified the object referred to by the input argument (obj) and returned
a handle to that object in y.5 Class Definition—Syntax Reference