Why does MATLAB set the Method Attributes of built-in methods to 'Hidden'?

4 次查看(过去 30 天)
'empty' is matlab built-in method."At the bottom of the documentation page, it is mentioned: 'empty is a hidden, public, static method of all nonabstract MATLAB® classes.''
There is a question, if user build a classes method,for certain reasons, users may want to set a class method as 'Hidden' to prevent others from seeing it. However, in the case of MATLAB built-in methods, everyone is aware of their existence. So, what's the purpose of MATLAB setting the Attributes of this method as 'Hidden'?"
If you input mc=?SubClass in command line and open mc-->MethodList in workspace,you will find two method, one is 'SubClass' ,another is 'empty'.In fact, the 'empty' method isn't completely hidden, so what's the significance of setting a built-in method to 'Hidden'?"
classdef SubClass < Base
methods
function obj=SubClass(value)
obj=obj@Base(value);
end
end
end
classdef Base
properties(Access=private)
a;
end
methods
function obj=Base(value)
obj.a=value;
end
end
methods (Access=private)
function Fun(obj)
disp(num2str(obj.a));
end
end
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Software Development Tools 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by