s2第六章继承和多态

 public class Employee
    {
       //年龄
        public int Age { get; set; }
       //性别
        public Gender Gender { get; set; }
       //ID
        public string ID { get; set; }
       //姓名
        public string  Name { get; set; }
       //给Employee类的函数
        public List<Job> WorkList { get; set; }
        public Employee(string id,int age , string name,Gender gender,List<Job>List)
        {
            this.ID = id;
            this.Age = age;
            this.Name = name;
            this.Gender = gender;
            this.WorkList = List;
        }
    }
直接 调用
    public Job(string name, string description)
        {
            this.Name = name;
            this.Description = description;
        }

面向的对象的三大特性:

  封装 继承 多态 (抽象)

1.什么是继承

      移除类的冗余   简单的来说就是把公共的属性或字段提炼出来    作为父类 

     当子类用的时候直接调用

原文地址:https://www.cnblogs.com/BaoWangZe/p/8796813.html