What does the “private” modifier do?

前端 未结 13 1119
予麋鹿
予麋鹿 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:58

    Some coding styles recommend that you put all the "public" items first, followed by the "private" items. Without a "private" keyword, you couldn't do it that way around.

    Update: I didn't notice the "c#" tag on this so my answer applies more to C++ than to C#.

提交回复
热议问题