using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Text.Json.Serialization;
class Human
{
public string Name { get; set; }
public int Age { get; set; }
}
class Warrior : Human
{
public void Atk()
{
Console.WriteLine("战士{0},{1}岁会攻击",Name,Age);
}
}
class Program
{
static void Main()
{
Warrior warrior = new Warrior();
warrior.Name = "C";
warrior.Age = 15;
warrior.Atk();
}
}
C# 继承
最新推荐文章于 2024-08-14 21:15:00 发布