变量类型
using System;class student
{
public student (double allow,string demand,string location)
{
this.allow=allow;
this.demand=demand;
this.location=location;
}
public double allow;
public string demand;
public string location;
public static readonly student bachelor;
public static readonly student master;
public static readonly student doctor;
static student()
{
bachelor=new student(200,"studious","11楼");
master=new student(1000,"creative","2楼");
doctor=new student(2000,"inventive","3楼");
}
}
class app
{
public static void Main()
{
student student1=student.master;
Console.WriteLine("该学生每月的津贴为:{0}",student1.allow);
Console.WriteLine("该学生的培养标准是:{0}",student1.demand);
Console.WriteLine("该学生住址:{0}",student1.location);
}
}
请问这里的public static readonly student bachelor;public static readonly student master;
public static readonly student doctor;是什么意思呢》
static student()
{
bachelor=new student(200,"studious","11楼");
master=new student(1000,"creative","2楼");
doctor=new student(2000,"inventive","3楼");
}
这些又是什么意思呢???