⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cs

📁 C#2.0宝典源码,C#经典书籍,很多例子
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace Example7_12 {
    class Program {
        static void Main(string[] args) {
            People myPeople = new People();
            myPeople.Eat();
            myPeople.Sleep();
            Student myStudent = new Student();
            myStudent.Eat();
            myStudent.Sleep();
            Worker myWorker = new Worker();
            myWorker.Eat();
            myWorker.Sleep();
            Console.ReadLine();
        }
    }

    public class People {
        /// <summary>
        /// 基类Eat方法
        /// </summary>
        public void Eat() {
            Console.WriteLine("基类Eat方法被调用!");
        }

        /// <summary>
        /// 基类Sleep方法
        /// </summary>
        public void Sleep() {
            Console.WriteLine("基类Sleep方法被调用!");
        }
    }

    public class Student : People {
    }

    public class Worker : People {
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -