What is a method called if you do not use an access identifier?

后端 未结 1 759
抹茶落季
抹茶落季 2021-01-06 16:48

I do not know what a method without an access identifier is called. In this code block, I am referring to the void updateNumTo5 method.

private          


        
相关标签:
1条回答
  • 2021-01-06 17:12

    The default access modifier (not identifier) is private for methods. So this:

    private void Foo()
    {
    }
    

    is equivalent to

    void Foo()
    {
    }
    

    The general rule is that the default access modifier is always the most restricted you could specify it as. So for example, non-nested types are internal by default, whereas nested types are private by default.

    0 讨论(0)
提交回复
热议问题