What does the “private” modifier do?

前端 未结 13 978
予麋鹿
予麋鹿 2021-01-17 07:24

Considering \"private\" is the default access modifier for class Members, why is the keyword even needed?

13条回答
  •  花落未央
    2021-01-17 07:52

    As Robert Paulson said in his answer, the private modifier is not just used on members, but also on types. This becomes important because the default for types is internal which can leak unintentionally if you use the InternalsVisibleToAttribute.

提交回复
热议问题