⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dog.cc

📁 做为SD0609的一员,我扎实的基础是如何打出来的,来看看我那时连猴子选大王都不会的人,是如何成长起来的吧!主要包括我所做的C++,JAVA基础联系.乱是乱了点,不过如果真心想学习,打好基础,看看也不
💻 CC
字号:
#include <iostream>using namespace std;enum BREED { GOLDEN, CAIRN, DANDIE, SHETLAND, DOBERMAN, LAB };class Mammal{protected:	int itsAge;	int itsWeight;public:	// constructors	Mammal():itsAge(0),itsWeight(100)	{		cout << "Mammal()" << endl;	}	~Mammal()	{		cout << "~Mammal()" << endl;	}	//accessors	int	 GetAge() const	{		return itsAge;	}	void SetAge(int a)	{		itsAge = a;	}	int	 GetWeight() const	{		return itsWeight;	}	void SetWeight( int w )	{		itsWeight = w;	}	//Other methods	void Speak() const	{		cout << "Mammal speak" << endl;	}	void Sleep() const	{		cout << "Mammal sleep" << endl;	}};class Dog : public Mammal{protected:	BREED itsBreed;public:	// Constructors	Dog():itsBreed(LAB)	{	//	itsAge = 0;	//	itsWeight = 100;		cout << "Dog()" << endl;	}	~Dog()	{		cout << "~Dog()" << endl;	}	// Accessors	BREED GetBreed() const	{		return itsBreed;	}	void  SetBreed(BREED b)	{		itsBreed = b;	}	// Other methods	void WagTail()	{		cout << "Dog wags tail" << endl;	}	void BegForFood()	{		cout << "Dog begs for food" << endl;	}};int main(){	Dog od;		return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -