| 本帖最后由 keer_zu 于 2015-11-25 20:41 编辑 
 头文件:
 
 #ifndef ANIMAL_H
#define ANIMAL_H
//===============================================================
//
//                                  animal
//                                 鍔ㄧ墿鍩虹被
//
//===============================================================
//#include <strings.h>
//#include <string.h>
#include <string>
using namespace std;
typedef enum {
        test0 = 0,
        test1 = 1,
        test2 = 2,
        test3 = 3
}TEST;
class animal
{
private:
        string m_s;
        int m_foot;
        int m_food;
        TEST m_test;
        
public:
        animal():m_foot(4),m_food(1),m_test(test2),m_s("Hell luojianfeng!\n"){}
        animal& operator =(const animal& other);
        void breathe();                // 闈炶櫄鍑芥暟
        void set_foot(int foot){m_foot = foot;}
        int get_foot(){return m_foot;}
        void set_food(int food){m_food = food;}
        int get_food(){return m_food;}
        void set_test(TEST test){m_test = test;}
        void set_s(string s){m_s = s;}
};
//===============================================================
//
//                                       animal
//                                 楸肩被锛岄泦鎴愪簬鍔ㄧ墿鍩虹被
//
//===============================================================
class fish : public animal
{
public:
        void breathe();                // 闈炶櫄鍑芥暟
};
#endif
 
 |