在下面的代码中,如何 - 在内存管理方面 -class A
在 .NET (C#) 中分配和释放。
class A
{
public static m1(int x, int y)
{
int x, y;
return x+y;
}
int m2(int p, int q)
{
int p, int q;
return p+q;
}
int x=10;
int y;
const int x=10;
readOnly y=20;
public int x
{
get {y}
set {y=value}
}
}
class B
{
A a=new A(); // what happens when initializing class A;
}
注意: 的使用class B
可以是程序的入口点,也可以是对象实例,但这里的范围是内存管理和实例的分配class A
。