Tag: class hierarchy

我需要实现具有inheritance的C#深层复制构造函数。 有哪些模式可供选择?

我希望在C#中实现我的类层次结构的深度复制 public Class ParentObj : ICloneable { protected int myA; public virtual Object Clone () { ParentObj newObj = new ParentObj(); newObj.myA = theObj.MyA; return newObj; } } public Class ChildObj : ParentObj { protected int myB; public override Object Clone ( ) { Parent newObj = this.base.Clone(); newObj.myB = theObj.MyB; return newObj; } } […]