Hi, class properties are being reinitialized each time I call a method. the result of the multiplication is always 15. Could you please tell me where is the error? I don't want to use any argument in the constructor method.
classdef Multi properties x = 0; y = 0; end methods function obj = Multi() obj.x = 5; obj.y = 3; end function obj = X (obj, x) obj.x = x; end function obj = Y (obj, y) obj.y = y; end function obj = Mul (obj) disp (obj.x * obj.y); end end end
Best Answer