问题描述
- link环境下,什么是变量,什么是变量的作为?什么是变量的可见性?
-
link环境下,什么是变量,什么是变量的作为?什么是变量的可见性?
解决方案
作为?作用范围?
作用范围就是能使用变量的代码区域。
比如
class A
{
private int i;
void foo()
{
int j;
}
void bar()
{
//bar只能使用i,不能使用j
}
}
可见性是指,private protected还是public的,public是可见的,private是私有的,protected对于派生类是可见的,对于外部是私有的
时间: 2024-09-17 04:32:03