代碼告訴話多,所以看這個:如何正確重寫,提升物業
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
keywork而不是override
來簡單地隱藏基本實現,但是這是正確的嗎?