c# - What is Accessibility Capping? -
I am reading C # 5.0 briefly , and I think the concept access capping < / Strong> is as follows (extracting the original from the book):
< / P>
Can anyone explain this concept different definition with another example? With other words, what is its usefulness?
This book is saying because no access has been declared for category C, it is Internal
level is given as the default.
This means that the FU method of C has been marked as public
, it will be captured on the Internal
because class level What's the reason?
The reason for this is that it does not make sense to make the class member more accessible than the class, because no one will see anything because of the level of access to the member because the class is not Will be available
The last thing is saying that the property can still be useful in marking the property as public
, because if you later class C public
Then Fu will also be public
(otherwise you will have to change the fu with internal
to public
).
It seems that the book is misleading because it is explaining two things at one go, capping, and the fact that if you declare a level of access to a class If it does not, then it gets internal
by default
IMHO, it would have become clear
internal square microsoft {public void Foo () {}}
BTW, I also hate the fact that the class is called C. Was that person trying to reduce the cost of printing or something?
Comments
Post a Comment