Hi all,
I have tried to make an abstract class in the file Cat.h that already contains the class Cat, but I cant get the Cat class to extend the Abstract cat class. My goal is to make an interface for the Cat class.
Cat.h:
Error:Code:/** Enumerator for cat object types */ typedef enum { cob_Male, cob_Female, cob_NeuMale, cob_NeuFemale } Cat_Object; typedef enum { Cat_InitialState, Cat_Movement, Cat_ReproBehaviour } TypeOfCatState; class Abstract_Cat : public TAnimal { public: Abstract_Cat(); virtual ~Abstract_Cat(); virtual void BeginStep (void) = 0; ... virtual int EvaluateBestDirection() = 0; }; class Cat : public Abstract_Cat { public: Cat(int a_x, int a_y, Landscape * p_L, Cat_Population_Manager* p_PPM); virtual ~Cat(void); protected: //variables Cat_Population_Manager* m_OurPopulationManager; ... int StepsSoFarWithoutGoingHome; TypeOfCatState m_CurrentCState; //lists int QualityScoreArray[8]; //array for keeping the score values for each direction (0-7) - method:EvaluateBestDirection() vector<int> BestDirectionsList; //list for holding directions with the highest score //methods virtual void BeginStep (void); ... int EvaluateBestDirection(); }; class struct_Cat { public: int x; int y; Landscape* L; Cat_Population_Manager* CM; };
1>Cat.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Abstract_Cat::~Abstract_Cat(void)" (??1Abstract_Cat@@UAE@XZ) referenced in function "public: virtual __thiscall Cat::~Cat(void)" (??1Cat@@UAE@XZ)
1>Cat.obj : error LNK2019: unresolved external symbol "public: __thiscall Abstract_Cat::Abstract_Cat(void)" (??0Abstract_Cat@@QAE@XZ) referenced in function "public: __thiscall Cat::Cat(int,int,class Landscape *,class Cat_Population_Manager *)" (??0Cat@@QAE@HHPAVLandscape@@PAVCat_Population_Man ager@@@Z)
1>.\vc_mswd\almass.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
And if i remove the constructor in class Abstract_Cat (Abstract_Cat()) then i get an error message that says a cannot instantiate objects of an abstract class.



LinkBack URL
About LinkBacks
) then i get an error message that says a cannot instantiate objects of an abstract class. 


