繁体   English   中英

在派生类构造函数之后调用基类方法

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM