classdef A < handle
%UNTITLED Summary of this class goes here
% Detailed explanation goes here
methods
function obj = A ()
end
function printSomething (obj)
disp ('Object of class A') ;
end
end
end
classdef B < A
%UNTITLED2 Summary of this class goes here
% Detailed explanation goes here
methods
function obj = B ()
end
function printSomething (obj)
disp ('Object of class B');
end
end
end
instantiation of class A:
a = A () ;
a.printSomething ();
By executing the above line of code, you will see:
Object of class A
instantiation of class B:
b = B () ;
b.printSomething()
By executing the above line of code, you will see:
Object of class B
Type Check:
isa (b,'A')
1
isa (b,'B')
1
source
share