What can I do with a protected/private static variable?

前端 未结 7 2241
悲&欢浪女
悲&欢浪女 2021-01-01 18:00

I see I can write :

protected static

in my C# class (in my case, an aspx.cs). As well as :

private static

相关标签:
7条回答
  • 2021-01-01 18:38

    Use protected if you only want the variable to be accessible through certain classes, for instance when using polymorphism and inheritance. Public makes it always visible within the scope and private is pretty obvious.

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