[英]Call base class method after derived class constructor
我有以下課程:
class ClBase{
public ClBase(){/*do stuff..*/}
protected postConstructorMethod(){ /*do same stuff for all derived classes*/}
}
class ClInherited:ClBase{
public ClInherited():base(){/*do stuff..*/}
}
創建派生類后,我需要做一些事情。 有沒有什么方法可以在派生類構造函數之后調用“ postconstructorMethod()”?
提前致謝。
只需致電:
base.postConstructorMethod();
從您的ClInherited類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.