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

4 vues (au cours des 30 derniers jours)
fa wu
fa wu le 25 Août 2023
'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

Réponses (0)

Catégories

En savoir plus sur Software Development Tools dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by