objective c - C++ Class inheritance in Xcode? -


i making simple example of inheritance in c++. using xcode , whenever create subclass obtain error: use of undeclared identifier rat. these classes:

pet.h

#include <iostream> #include <string>  using namespace std;  class pet {   public:   // constructors, destructors   pet(): weight(1), food("pet chow") {}   ~pet() {}    //general methods   void eat();   void speak();      protected:         int weight;         string food; }; 

rat.h

#include <iostream> #include "pet.h"  using namespace std;  class rat::public pet {     rat() {}     ~rat() {}     // other methods     void sicken() { cout << "spreading plague" << endl; } } 

i think mean

class rat : public pet 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -