📄 mammal.h
字号:
//定义基类哺乳动物CMammal
#include <iostream >
using namespace std;
class CMammal
{
public:
CMammal() : m_Age(2), m_Weight(5){}; // 构造函数
~CMammal(){ };
//存取访问函数
int GetAge()const { return m_Age; }
void SetAge(int age) { m_Age = age; }
int GetWeight() const { return m_Weight; }
void SetWeight(int weight) { m_Weight = weight; }
//其它操作
void Move(){ cout << "哺乳动物移动" <<endl ;}
void Sleep(){ cout << "嘘!安静,我在睡觉。" << endl ; }
protected:
int m_Age; //动物的年龄
int m_Weight; //动物的体重
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -