备忘~
简单的例子:
.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的那个带参数的构造函数中 ^_^
类别:General Programming 查看评论文章来源:
http://hi.baidu.com/uestc%5Fay/blog/item/33e598ca4191c912bf09e672.html