为什么文档视图不能直接使用CDocument和CView类啊?
#include<afxwin.h>#include"resource.h"classMyDocument:publicCDocument{DECLARE_DYNCREA...
#include<afxwin.h>
#include "resource.h"
class MyDocument:public CDocument
{
DECLARE_DYNCREATE(MyDocument)
};
IMPLEMENT_DYNCREATE(MyDocument,CDocument)
class MyFrame:public CFrameWnd
{
DECLARE_DYNCREATE(MyFrame)
};
IMPLEMENT_DYNCREATE(MyFrame,CFrameWnd)
class MyView:public CView
{
public:
void OnDraw(CDC* aDC)
{}
DECLARE_DYNCREATE(MyView)
};
IMPLEMENT_DYNCREATE(MyView,CView)
class MyApp:public CWinApp
{
public:
BOOL InitInstance()
{
CSingleDocTemplate* DocT=new CSingleDocTemplate(IDR_MENU2,RUNTIME_CLASS(MyDocument)
,RUNTIME_CLASS(CFrameWnd),RUNTIME_CLASS(MyView));
AddDocTemplate(DocT);
CDocument* doc=DocT->CreateNewDocument();
if(doc!=NULL )
{
m_pMainWnd=DocT->CreateNewFrame(doc,NULL);
if(m_pMainWnd!=NULL)
DocT->InitialUpdateFrame((CFrameWnd*)m_pMainWnd,doc);
m_pMainWnd->ShowWindow(SW_SHOW);
}
return true;
}
}a;
CFrameWnd可以直接用,但是那两个就不行,如果不继承直接用的话程序直接返回0; 展开
#include "resource.h"
class MyDocument:public CDocument
{
DECLARE_DYNCREATE(MyDocument)
};
IMPLEMENT_DYNCREATE(MyDocument,CDocument)
class MyFrame:public CFrameWnd
{
DECLARE_DYNCREATE(MyFrame)
};
IMPLEMENT_DYNCREATE(MyFrame,CFrameWnd)
class MyView:public CView
{
public:
void OnDraw(CDC* aDC)
{}
DECLARE_DYNCREATE(MyView)
};
IMPLEMENT_DYNCREATE(MyView,CView)
class MyApp:public CWinApp
{
public:
BOOL InitInstance()
{
CSingleDocTemplate* DocT=new CSingleDocTemplate(IDR_MENU2,RUNTIME_CLASS(MyDocument)
,RUNTIME_CLASS(CFrameWnd),RUNTIME_CLASS(MyView));
AddDocTemplate(DocT);
CDocument* doc=DocT->CreateNewDocument();
if(doc!=NULL )
{
m_pMainWnd=DocT->CreateNewFrame(doc,NULL);
if(m_pMainWnd!=NULL)
DocT->InitialUpdateFrame((CFrameWnd*)m_pMainWnd,doc);
m_pMainWnd->ShowWindow(SW_SHOW);
}
return true;
}
}a;
CFrameWnd可以直接用,但是那两个就不行,如果不继承直接用的话程序直接返回0; 展开
1个回答
展开全部
#include<iostream.h>
#include<stdlib.h>
class complex{
public:
complex(){}
complex(double r,double i):real(r),imag(i){}
complex(complex &c){};
void set();
// void display();
friend complex operator +(const complex &c1,const complex &c2);
friend complex operator -(const complex &c1,const complex &c2);
friend ostream & operator<< (ostream &out,const complex &c);
double getreal(){return real;}
double getimag(){return imag;}
private:
double real;
double imag;
#include<stdlib.h>
class complex{
public:
complex(){}
complex(double r,double i):real(r),imag(i){}
complex(complex &c){};
void set();
// void display();
friend complex operator +(const complex &c1,const complex &c2);
friend complex operator -(const complex &c1,const complex &c2);
friend ostream & operator<< (ostream &out,const complex &c);
double getreal(){return real;}
double getimag(){return imag;}
private:
double real;
double imag;
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询