通过泛型类实现输出学生信息

Posted on 2018-12-08 20:51  努力成长静待花开  阅读(747)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:(泛型类的继承)

  class DerivedClass<类型参数T>:BaseClass<类型参数T>

  {

  }

实现代码:

        class BstuInfo<T>
        {
            public T Num;
            public T Name;
            public T Sex;
            public T Age;
            public T Birthday;
            public T Salary;
        }
        class HstuInfo<T>:BstuInfo<T>
        {
            public T Chinese;
            public T Match;
            public T English;
        }