建立类Student,包含私有成员变量
int age;string name;string sid
a) 3个变量都可以被外部访问,age是读写属性,不能小于0;name和sid是只读属性
b) 建立类SClass,包含Student集合,建立根据sid和集合下标的索引器。

解决方案 »

  1.   

    public class Student
    {
    public Student(int ssid,string nname) {
            sid = ssid;
            name = nname;
    }
        private uint arg;
        private string name;
        private int sid;
        public uint Arg
        {
            get { return this.arg; }
            set { this.arg = value; }
        }
        public string Name
        {
            get { return this.name; }
        }
        public int Sid
        {
            get { return this.sid; }
        }
        
    }
    public class SClass<Sendent>
    {
        public SClass()
        {    }
    }