What does the “private” modifier do?

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

    I usually leave private out but I find it useful for lining up code:

    private   int    x;
    public    string y;
    protected float  z;
    

    VS:

    int x;
    
    public    string y;
    protected float  z;
    

提交回复
热议问题