Hi all,
I thought I understood the ideas behind inheritance and such like, but some simple code I am trying to compile with VC++ 2005 Express is giving me link errors. The code is as follows:-
In one file, ACEntity.h, I have a pure abstract class.
#ifndef ACENTITY_H
#define ACENTITY_H
#include <string>
class ACEntity
{
public:
std::string sID;
ACEntity();
virtual ~ACEntity();
};
#endif
In another, ACSpace.h, I have an abstract class that inherits from ACEntity.
#ifndef ACSPACE_H
#define ACSPACE_H
#include "ACEntity.h"
class ACSpace : public ACEntity
{
public:
ACSpace();
virtual ~ACSpace();
virtual void AcceptEntityEntrance( ACEntity *e)=0;
virtual void AcceptEntityExit( ACEntity *e)=0;
};
#endif
I then have a concrete class that inherits from ACSpace. The header for this is.
#ifndef CAREA_H
#define CAREA_H
#include "ACSpace.h"
class ACEntity;
class CArea : public ACSpace
{
public:
float m_flHeight, m_flWidth;
CArea(float t_flWidth, float t_flHeight);
virtual ~CArea();
void AcceptEntityEntrance( ACEntity *e) {};
void AcceptEntityExit( ACEntity *e) {};
};
#endif
and the implementation so far is.
#include "CArea.h"
CArea::CArea(float t_flWidth, float t_flHeight)
{
m_flWidth = t_flWidth;
m_flHeight = t_flHeight;
}
When I try to compile this, I get the following error.
CArea.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CArea::~CArea(void)" (??1CArea@@UAE@XZ) referenced in function "public: virtual void * __thiscall CArea::`scalar deleting destructor'(unsigned int)" (??_GCArea@@UAEPAXI@Z)
Can someone please explain what I'm doing wrong here, because as far as I can see, what I have should compile?
Thanks in advance,
Wibbs