//实现接口的类必须包括接口的所有方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public class TallGuy:IClown
{
public string Name;
public int Height;
public void TalkAboutYourself()
{
MessageBox.Show("My name is " + Name + " and I'm " + Height + " inches tall.");
}
public string FunnyThingIHave
{
get { return "big shoes"; }
}
public void Honk()
{
MessageBox.Show("Honk honk!");
}
}
}
//接口类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
interface IClown
{
string FunnyThingIHave { get; }
void Honk();
}
}