📄
字号:
#include "stdafx.h"
#include <iostream.h>
class CEye
{
public:
void Look(void);
};
void CEye::Look(void)
{
cout << "look" <<endl;
}
class CNose
{
public:
void Smell(void);
};
void CNose::Smell()
{
cout << "smell"<<endl;
}
class CMouth
{
public:
void Eat(void);
};
void CMouth::Eat(void)
{
cout << "eat" <<endl;
}
class CEar
{
public:
void Listen(void);
};
void CEar::Listen(void)
{
cout << "listen" <<endl;
}
// 正确的设计,冗长的程序
class CHead
{
public:
void Look(void) { m_eye.Look(); }
void Smell(void) { m_nose.Smell(); }
void Eat(void) { m_mouth.Eat(); }
void Listen(void) { m_ear.Listen(); }
private:
CEye m_eye;
CNose m_nose;
CMouth m_mouth;
CEar m_ear;
};
void main()
{
CHead h;
h.Look();
h.Smell();
h.Eat();
h.Listen();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -