1.静态属性和静态方法
静态方法的调用,ClassName::mothodName();
class Pet { public: Pet(std::string theName); ~Pet(); static int getCount();//公开的静态方法 protected: std::string name; private: static int count;//私有的静态变量 }; class Dog:public Pet { public: Dog(std::string theName); }; class Cat:public Pet { public: Cat(std::string theName); }; int Pet::count = 0;//初始化静态变量