program.cs
来自「c#开发宝典 光盘内容。本光盘主要为书中的源程序」· CS 代码 · 共 43 行
CS
43 行
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 + =
减小字号Ctrl + -
显示快捷键?