What does the “private” modifier do?

前端 未结 13 969
予麋鹿
予麋鹿 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;
    
    0 讨论(0)
提交回复
热议问题