访问说明符 [英] Access Specifiers
本文介绍了访问说明符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
将变量声明为
是什么意思
private int a = 10;
受保护的字符串message =";
public int b = 10;
在c#.net .aspx页的类级别.(服务器端)
What is the meaning when we declare variables as
private int a=10;
protected string message="";
public int b=10;
at class level in c#.net .aspx page.(server side)
推荐答案
我认为信息很好地隐藏在文档中:.
:)
I think info is well hidden in the documentation: "Access Modifiers (C# Reference)".
:)
private int a = 10;
意味着它是一个私有变量,您不能在派生自包含该变量的基类的子类中访问它.
您只能在父类中访问它..
受保护的字符串message =";
意味着它也是一种私有变量,可以在父类和直接派生类中访问
public int b = 10;
意味着您可以在整个程序中访问它
希望这对您有帮助
问候. :-O
private int a=10;
Means its a private variable and you can not access it in child class derived from base class containing this variable.
You can access it within parent class only..
protected string message="";
Means it is also kinda private variable which can be accessed within parent class and immediate derived class
public int b=10;
Means you can access it all over you program
Hope this helps you
Regards. :-O
这篇关于访问说明符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文