@作者: ay @文章出处: cnss-ay.com @Notice: 转载请注明出处
简单的例子:
.h文件:
class CFileLog { public: CFileLog() ; CFileLog( const char *WorkDir , const char* FileType ) ; ~CFileLog() ; }; class CDateFileLog : public CFileLog { public: CDateFileLog(); CDateFileLog( const char *WorkDir , const char* FileType ) ; ~CDateFileLog() ; };
.cpp文件
CDateFileLog::CDateFileLog( const char *WorkDir , const char* FileType ) : CFileLog( WorkDir , FileType) { }
然后调用代码
CDateFileLog g_CPacketLog( test , test ) ;
这2个参数会传到CFileLog的那个带参数的构造函数中 ^_^