📄
字号:
#include "stdafx.h"
#include <iostream.h>
class CBase
{
public:
CBase(int x, int y)
{
m_nX = x;
m_nY = y;
}
void Display()
{
cout << m_nX << " " << m_nY <<endl;
}
protected:
int m_nX;
int m_nY;
};
class CDerived : public CBase
{
public:
CDerived(int x, int , int z);
void Display();
protected:
private:
int m_nZ;
};
CDerived::CDerived(int x, int y, int z)
:CBase(x, y)
{
m_nZ = z;
}
void CDerived::Display()
{
cout << m_nX << " " << m_nY << " " << m_nZ <<endl;
}
void main()
{
CDerived *d = new CDerived(1, 2, 4);
CBase *b = d;
b->Display();
d->Display();
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -