Microsoft Visual Studio 2010做的C# winform类的静态成员及静态方法,主要代码:
public class Student
{
private int IDBase = 20080000;
private int ID;
public static int StudentNumber;
public string Name;
public int age;
public string Home;
public Student(string Name,int age, string Home)
{
this.Name = Name;
this.age = age;
this.Home = Home;
StudentNumber++;
this.ID = 20080000 + StudentNumber;
}
public string getinfo()
{
string sReturn = "";
sReturn += "学号:" + ID + "\n";
sReturn += "姓名:" + Name + "\n";
sReturn += "年龄:" + age + "\n";
sReturn += "住址:" + Home + "\n";
return sReturn;
}
public static int getStudentNumber()
{
return StudentNumber;
}
}
评论0
最新资源