classdef BasicClass properties Value {mustBeNumeric} end methods % contstructor function obj = BasicClass(value) % obj is by default an instance of BasicClass, no need to assign if nargin == 1 obj.Value = value; end end function r = roundOff(obj) r = round([obj.Value],2); end function r = multiplyBy(obj,n) r = [obj.Value] * n; end % operator overloading function r = plus(o1, o2) % [x.Value] used to support object arrays by default r.Value = [o1.Value] + [o2.Value]; end end end