Why does MATLAB set the Method Attributes of built-in methods to 'Hidden'?
3 views (last 30 days)
Show older comments
'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 Comments
Answers (0)
See Also
Categories
Find more on Construct and Work with Object Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!