📄 test.txt
字号:
#include "stdafx.h"
#include <iostream.h>
#include <string.h>
class CDraw
{
public:
virtual char* GetMe() = 0;
protected:
int m_nX;
int m_nY;
};
class CCircle : public CDraw
{
public:
friend void Test(CDraw* p);
char* GetMe()
{
return "circle";
}
protected:
private:
int m_nA;
};
class CRect : public CDraw
{
public:
friend void Test(CDraw* p);
char* GetMe()
{
return "rect";
}
private:
int z;
};
void Test (CDraw* p)
{
if (strcmp(p->GetMe(), "rect") == 0)
{
CRect* p1 = (CRect*)p;
p1->z = 9;
}
if (strcmp(p->GetMe(), "circle") == 0)
{
CCircle* p1 = (CCircle*)p;
p1->m_nA = 8;
}
}
void main()
{
CRect *p = new CRect();
Test(p);
CCircle *p1 = new CCircle();
Test(p1);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -