【发布时间】:2016-09-27 09:05:03
【问题描述】:
代码说明的不仅仅是文字,所以看看这个:
public abstract class ViewObject: INotifyPropertyChanged {
public virtual string Id {
get {
return this.GetType().Name;
}
}
}
public class Object : ViewObject {
private string id = string.Empty;
public override string Id {
get {
return this.id;
}
set {
this.id = value;
}
}
}
在抽象类中实现基本实现的所需行为的正确方法是什么(是的,它应该有一个基本实现,而不是其他东西)?
我只能想到使用new 键而不是override 来简单地隐藏基本实现,但是这样对吗?
【问题讨论】: