using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
interface Iatext
{
int he { get; set; }
int att { get; set; }
int de { get; set; }
void attack();
void stand();
void defense();
}
public class Human : Iatext
{
private int hea;
private int attc;
private int def;
public int he
{
get { return hea; }
set { hea = value; }
}
public int att
{
get { return attc; }
set { attc = value; }
}
public int de
{
get { return def; }
set { def = value; }
}
public void attack()
{
Console.WriteLine("攻击动作很华丽");
}
public void stand()
{
Console.WriteLine("站在那里气宇下昂");
}
public void defense()
{
Console.WriteLine("防御姿势很优美");
}
}
class Program
{
static void Main(string[] args)
{
Human hu = new Human();
Iatext ite = (Iatext)hu;
Console.Write("小明:");
ite.attack();
Console.Write("小明:");
ite.stand();
Console.Write("小明:");
ite.defense();
hu.he = 1000;
hu.att = 5000;
hu.de = 3000;
Console.WriteLine("姓名:小明 \n种族:人族");
Console.WriteLine("------------------------------------------------------");
Console.WriteLine("状态");
Console.WriteLine("生命:{0}",ite.he);
Console.WriteLine("------------------------------------------------------");
Console.WriteLine("战斗力");
Console.WriteLine("攻击力:{0} \t\t\t 防御:{1}",ite.att,ite.de);
Console.Read();
}
}
}
运行结果: