C#继承实现有点小疑惑

class animal

{

public animal(){};

private string name;

public animal ( string name)

{

this.name=name;

}

public virtual void show()

{

console.writeln("我叫:{0}",name);

}

}

 

class people:animal

{

protected animal an;

punlic void decorate(animal an )

{

this.an=an;

}

public override void show()

{

.........

}

}

 

我不太明白

protected animal an;

punlic void decorate(animal an )

{

this.an=an;

}

写这段代码有什么作用


holdtom
浏览 533回答 1
1回答

慕尼黑5688855

初始化对象
打开App,查看更多内容
随时随地看视频慕课网APP