[英]Call base class method after derived class constructor
I have the following classes: 我有以下课程:
class ClBase{
public ClBase(){/*do stuff..*/}
protected postConstructorMethod(){ /*do same stuff for all derived classes*/}
}
class ClInherited:ClBase{
public ClInherited():base(){/*do stuff..*/}
}
I need to do stuff after creating the derived classes. 创建派生类后,我需要做一些事情。 Is there any way to call "postconstructorMethod()" after the derived class constructor? 有没有什么方法可以在派生类构造函数之后调用“ postconstructorMethod()”?
Thanks in advance. 提前致谢。
Just call: 只需致电:
base.postConstructorMethod();
from your ClInherited class. 从您的ClInherited类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.