I have a compile problem here.
I have a vector declared as:
Code:
std::vector<CGameObject> _vGameObjects;
CGameObject is an abstract class.
Code:
_vGameObjects.push_back(_paddle);
In the code above I want to push a _paddle object, which is an instance of a concrete object derived from the CGameObject.
The compiler (VC++ 6.0) generates an error and a series of warnings:
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : error C2259: 'CGameObject' : cannot instantiate abstract class due to following members:
f:\projects\simple game\game1\src\cgameobject.h(33) : see declaration of 'CGameObject'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4259: 'void __thiscall CGameObject::InitBoundingBoxes(void)' : pure virtual function was not defined
f:\projects\simple game\game1\src\cgameobject.h(51) : see declaration of 'InitBoundingBoxes'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4259: 'class std::vector<struct BBox,class std::allocator<struct BBox> > &__thiscall CGameObject::BoundingBoxes(void)' : pure virtual function was not defined
f:\projects\simple game\game1\src\cgameobject.h(59) : see declaration of 'BoundingBoxes'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : error C2259: 'CGameObject' : cannot instantiate abstract class due to following members:
f:\projects\simple game\game1\src\cgameobject.h(33) : see declaration of 'CGameObject'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4259: 'void __thiscall CGameObject::InitBoundingBoxes(void)' : pure virtual function was not defined
f:\projects\simple game\game1\src\cgameobject.h(51) : see declaration of 'InitBoundingBoxes'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4259: 'class std::vector<struct BBox,class std::allocator<struct BBox> > &__thiscall CGameObject::BoundingBoxes(void)' : pure virtual function was not defined
f:\projects\simple game\game1\src\cgameobject.h(59) : see declaration of 'BoundingBoxes'
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CGameObject *,const class CGameObject &)' being compiled
Any suggestions? Thanks!