C#程序设计西安交大MOOC第八章继承

继承的概念的引入

举例
雇员与精力
精力是管理公司的一种特殊的雇员,经理拥有普通雇员的所有的特征,同时还能得到公司发送的特殊的津贴
可以使用两个类分别描述雇员和经理两类人
假设雇员类Employee包含姓名,工作部门,基本工资这三个字段以及相关的方法
经理类Manager包含姓名,工作部门,基本工资,特殊津贴四个字段以及相关的方法
下面分别是Employee和Manager的类的代码的声明

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp34
{
   
    
    class Manager//经理类
    {
   
    
    
        private string name;//姓名
        private double salary;//公资
        private string depart

猜你喜欢

转载自blog.csdn.net/weixin_43428283/article/details/111413672