我有以下情形填充基继承的类作为一个对象,而不是每一个属性
方案1联:
public class TT : t
{
public int x { get; set; }
public TT(t name, int name2)
{
this.att1 = name.att1;
this.att2 = name.att2;
this.att3 = name.att3;
x = name2;
}
}
方案2:
public class TT : t
{
public int x { get; set; }
public TT(t name, int name2)
{
this = name;
x = name2;
}
}
有一种方法来传递基类继承类“t”作为一个整体对象,而不是必须从基类的属性分配每个属性?