主题:[讨论]C#里面的变量问题?
chotqy
[专家分:50] 发布于 2007-03-24 11:01:00
我定义了一个BOOL的变量在A类付为TRUE,在B类里面使用这个变量如果该变量为TRUE才执行我的函数。这个变量怎么使用?
回复列表 (共1个回复)
沙发
happyw2004 [专家分:840] 发布于 2007-03-27 17:21:00
class a
{
private bool p;
public bool P
{
get
{
return this.p;
}
}
}
class b
{
public bool f(a t)
{
if(t.P == true)return true;
return false;
}
}
class c
{
public static void Main()
{
a aa=new a();
b bb = new b();
Console.WriteLine(bb.f(aa).ToString());
}
}
我来回复