Object oriented programming Matlab

MATLAB’s support for object-oriented programming includes classes, inheritance, virtual dispatch, packages, pass-by-value semantics, and pass-by-reference semantics.

Step 1 :

Create a .M files say dummyFunction2.m in the same directory in which you were working. as :

classdef dummyFunction2 % class declaration
    methods % to define methods inside class 
        function anyName(this) % method declaration
            disp('Hello!') % method statements
        end % end function
    end % end methods block 
end % end class

Step 2 :

Call this .M file from matlab prompt as :

>> a = dummyFunction2; % making objects
>> a.anyName;