using System; using System.Collections.Generic; using System.Text; namespace VA17.__泛型继承之开放与封闭 { //普通基类的创建 public abstract class baseClass { protected int user_name; //定义字段 public virtual int user_Name { set { user_Name = value; } get { return user_Name; } } //构造函数 public baseClass(int index) { user_name = index; } public abstract void method(int t); } class Program { static void Main(string[] args) { // 所有的类型可以分为 开放类型 封闭类型 两部分 // 开放类是指含有类型参数的类型,它包括 // 1)类型参数的本身 <T> // 2)以开放类型为元素类型的数组类型 // 3)开放类型的构造类型 //GenericDemo<T> 由于含有参数 <T> 所以是开放类型 //GenericDemo<int> 封闭类型 //GenericDemo<string> 封闭类型 } } } |
|