?? list1201.cpp
字號:
//Listing 12.1 Simple inheritance
#include <iostream>
using namespace std;
enum BREED { GOLDEN, CAIRN, DANDIE, SHETLAND, DOBERMAN, LAB };
class Mammal
{
public:
// constructors
Mammal();
~Mammal();
//accessors
int GetAge() const;
void SetAge(int);
int GetWeight() const;
void SetWeight();
//Other methods
void Speak() const;
void Sleep() const;
protected:
int itsAge;
int itsWeight;
};
class Dog : public Mammal
{
public:
// Constructors
Dog();
~Dog();
// Accessors
BREED GetBreed() const;
void SetBreed(BREED);
// Other methods
WagTail();
BegForFood();
protected:
BREED itsBreed;
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -