program.cs
来自「csharp课本的源代码」· CS 代码 · 共 36 行
CS
36 行
using System;
namespace InheritanceExample
{
public class Animal
{
public Animal()
{
Console.WriteLine("Hello, Animal!");
}
public Animal(string name)
{
Console.WriteLine("Hello,My name is " + name + "!");
}
public void Eat()
{
Console.WriteLine("Eating");
}
}
public class Cat : Animal
{
public Cat()
{
Console.WriteLine("Hello, Cat!");
}
}
class Program
{
static void Main(string[] args)
{
Cat e = new Cat();
e.Eat();
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?