
c++编程时遇到的,希望给详解,下面是部分程序, 30
classCMyApp:publicCWinApp{public:boolInitInstance();};boolCMyApp::InitInstance(){CMyW...
class CMyApp:public CWinApp
{
public:
bool InitInstance();
};
bool CMyApp::InitInstance()
{
CMyWnd*pFrame=new CMyWnd;
pFrame->Create(0,_T("中国象棋,路彦坤"));
pFrame->ShowWindow(SW_SHOWMAXIMIZED);
pFrame->UpdateWindow();
this->m_pMainWnd=pFrame;
return TRUE;
}
CMyApp ThisApp;
出错::\新建文件夹\Microsoft Visual Studio\MyProjects\plus\Debug\Cpp1.cpp(369) : error C2555: 'CMyApp::InitInstance' : overriding virtual function differs from 'CWinApp::InitInstance' only by return type or calling convention
g:\vc98\mfc\include\afxwin.h(4031) : see declaration of 'CWinApp'
Error executing cl.exe. 展开
{
public:
bool InitInstance();
};
bool CMyApp::InitInstance()
{
CMyWnd*pFrame=new CMyWnd;
pFrame->Create(0,_T("中国象棋,路彦坤"));
pFrame->ShowWindow(SW_SHOWMAXIMIZED);
pFrame->UpdateWindow();
this->m_pMainWnd=pFrame;
return TRUE;
}
CMyApp ThisApp;
出错::\新建文件夹\Microsoft Visual Studio\MyProjects\plus\Debug\Cpp1.cpp(369) : error C2555: 'CMyApp::InitInstance' : overriding virtual function differs from 'CWinApp::InitInstance' only by return type or calling convention
g:\vc98\mfc\include\afxwin.h(4031) : see declaration of 'CWinApp'
Error executing cl.exe. 展开
展开全部
CWinApp::InitInstance的返回类型是BOOL,你重载时返回类型也必须是BOOL
追问
具体点
追答
BOOL和bool是两个不同类型
展开全部
自己写的还是用模版生成的?直接用模版的应该没有问题的。
追问
自己写的
追答
你直接用模版生成吧。自己写也没什么锻炼的价值,我写了这么多年了,让我自己写也写不来,呵呵。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个是继承吧?那怎么没有构造函数的继承?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询