110,536
社区成员
发帖
与我相关
我的任务
分享
interface IWork
{
void working();
}
class Persion
{
public string Name{get;set;}
public int Age {get;set;}
}
class Employee : Persion,IWork
{
public void Working()
{
Console.WriteLine("{0} is Working",Name);
}
}
public Program
{
static void Main(string[] args)
{
IWork p = new Employee
{
Name = "巫妖王"
};
///只有Working
p.Working();
Persion q = new Employee
{
Name = "巫妖王"
};
///q 有name Age 但是没有Working
var cc = q.Name;
var ccc = q.Age;
}
}