cannot instatiate abstract class

class CD3DRenderer : public CRenderInterface
{
public:
CD3DRenderer();
~CD3DRenderer();
bool Initialize(int w, int h, WinHWND mainWin, bool fullScreen);
void Shutdown();
void SetClearCol(float r, float g, float b);
void StartRender(bool bColor, bool bDepth, bool bStencil);
void ClearBuffers(bool bColor, bool bDepth, bool bStencil);
void EndRendering();
// void SetMaterial(stMaterial *mat);

void CalculateProjMatrix(float fov, float n, float f);
void CalculateOrthoMatrix(float n, float f);

int CreateStaticBuffer(VertexType, PrimType, int totalVerts, int totalIndices,
int stride, void **data, unsigned int *indices, int *staticId);

int Render(int staticId);
private:
void OneTimeInit();
private:
D3DCOLOR m_Color;
LPDIRECT3D9 m_Direct3D;
LPDIRECT3DDEVICE9 m_Device;
bool m_renderingScene;

stD3DStaticBuffer *m_staticBufferList;
int m_numStaticBuffers;
int m_activeStaticBuffer;
};

bool CreateD3DRenderer(CRenderInterface **pObj);


bool CreateD3DRenderer(CRenderInterface **pObj)
{
if(!*pObj) *pObj = new CD3DRenderer;// I get the error c2259 cannot instatiate abstract class here,why?
else
return false;

return true;
}
Haven't used those classes before but did see a couple references on the web that might help.

The general idea I read is that CD3DRenderer is a base class w/ some pure virtual member functions so you need to inherit the class first and implement the abstract functions before trying to instatiate the object.

http://www.gamedev.net/community/forums/topic.asp?topic_id=431986
and
http://www.vbgore.com/forums/how-to-make-a-private-server-for-any-game--t1175s0.html
Have you implemented any of the functions from your class?
Have you implemented all of the functions you inherit from the interface?

You should also use new CD3DRendered();

Abstract class is a class with pure-virtual methods. This is probably because the interface has some pure-virtual methods you have not implemented.
Topic archived. No new replies allowed.