?? 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 + -