110,473
社区成员
发帖
与我相关
我的任务
分享
public class A
{
public A(string Name)
{
this.Name = Name;
}
public string Name { get; set; }
public A Clone()
{
return (A)this.MemberwiseClone();
}
}
public class B : A
{
public B(string Name)
: base(Name)
{
this.Count = 0;
}
public int Count { get; set; }
public new B Clone()
{
B b = (B)base.Clone();
b.Count = 1;
return b;
}
}
B b = new B("test");//b.Name="test";b.Count=0;
B c = b.Clone();//c.Name="test";c.Count=1;