classdef Car
properties (Access = private)
producer
end
methods
% Constructor
function self = Car(p)
self.producer = p;
end
% Accessor
function p = getProducer(self)
p = self.producer;
end
function disp(self)
fprintf('Producer: %s\n', self.producer);
end
% Mutator
function self = setProducer(self, p)
self.producer = p;
end
end
end
classdef Sedan < Package.Car
properties (Access = private)
model
end
methods
% Constructor
function self = Sedan(p, m)
self = self@Package.Car(p);
self.model = m;
end
% Accessor
function p = getModel(self)
p = self.model;
end
function disp(self)
disp@Package.Car(self)
fprintf('Model: %s\n', self.model);
end
% Mutator
function self = setModel(self, m)
self.model = m;
end
end
end