namespace InterfaceType1
{
interface ImyInterface
{
string ID
{
get;
set;
}
string Name
{
get;
set;
}
void ShowInfo();
}
class Program:ImyInterface
{
string id;
string name;
public string ID
{
get
{
return id;
}
set
{
id = value;
}
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public void ShowInfo()
{
Console.WriteLine("编号\t 姓名");
Console.WriteLine(ID + "\t"+ Name);
}
static void Main(string[] args)
{
Program program = new Program();
ImyInterface imyinterface = program;
imyinterface.ID = "01";
imyinterface.Name = "小郑";
imyinterface.ShowInfo();
Console.ReadLine();
}
}
}
请问 为什么void ShowInfo();会错误??????书里也是这样的、