[C#] 纯文本查看 复制代码
abstract class Fullname
{
public abstract void Name();
}
class xiaomin : Fullname
{
public override void Name()
{
Console.WriteLine("小明");
}
}
class xiaozhang : Fullname
{
public override void Name()
{
Console.WriteLine("小张");
}
}
class xiaochen : Fullname
{
public override void Name()
{
Console.WriteLine("小陈");
}
}
abstract class workyya
{
protected Fullname full;
public Fullname Full
{
set { full = value; }
}
public abstract void work();
}
class workcar : workyya
{
public override void work()
{
full.Name();
Console.WriteLine("开车上班");
}
}
class worktransit : workyya
{
public override void work()
{
full.Name();
Console.WriteLine("坐公交上班");
}
}
class workWalk : workyya
{
public override void work()
{
full.Name();
Console.WriteLine("走路上班");
}
}