#include "stdafx.h"
#include <iostream>
using namespace std;
class CDocument
{
public:
void OnFileOpen()
{
cout << "dialog....." << endl;
cout << "check file status...." << endl;
cout << "open file........." << endl;
Serialize(); //调用其虚函数
cout << "close file......" << endl;
cout << "update all views......" << endl;
}
virtual void Serialize() {};
};
class CMyDoc : public CDocument
{
public:
virtual void Serialize() //对虚函数进行编写
{
cout << "CMyDoc::Serialize()" << endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
CMyDoc myDoc;
myDoc.OnFileOpen();
return 0;
}
Inheritance[候大大]
最新推荐文章于 2022-04-30 22:40:55 发布