In Matlab (2017a), subclasses cannot restrict access to inherited methods that are declared abstract in the abstract superclass. Why wouldn't this be allowed? A small example:
super.m
classdef (Abstract) super
methods (Abstract)
out = fun(obj,in)
end
end
sub.m
classdef sub < super
properties
prop
end
methods (Access='private') %remove the access restriction to run without errors
function out = fun(obj,in)
out = obj.prop * in;
end
end
end
testInheritance.m
instance = sub;
Execution of testInheritance.m results in the following error message:
Error using sub Method 'fun' in class 'sub' uses different access permissions than its superclass 'super'.