110,536
社区成员
发帖
与我相关
我的任务
分享
class A
{
public static int a=0;
public A(int b)
{
a = b;
}
public static void func1(string str1)
{
//在此处想实现将a的值转换成字符串之后赋给参数str1
//在此操作访问变量a的时候会报错。
a = int.Parse(str1);
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine(A.a);
A A1 = new A(3);
Console.WriteLine(A.a);
A.func1("9");
Console.WriteLine(A.a);
Console.Read();
}
}