定义区间 c d:帮我解决c#问题

来源:百度文库 编辑:高考问答 时间:2024/05/02 09:53:48
using System;
public class a
{ public int s=1;//为什么要定义为公共的;
private int t{
set{}
}
public void s(){
Console.WriteLine("fangwens");
}

}
class node
{
public int s=5;
}
class test
{
static void Main(string[] args)
{
node f=new node();
a t=new a();

Console.WriteLine(f);
//Console.WriteLine(f.s);
//Console.WriteLine(t.s);
}
}
出现以下错误
baoh.cs(7,17): error CS0102: The type 'a' already contains a definition for 's'
baoh.cs(3,16): (Location of symbol related to previous error)
若把这句去了
程序还回出现错误吗
为什么要去掉,能解释一下吗

public int s=1;//为什么要定义为公共的;

把这句去了