   Virtual functions
  I am using a stack to handle the states of my game and in each node I have a pointer to a dervied class of cEngine, cMenuEngine,cPlayEngine etc. cEngine is abstract and has no impelmentions of functions like Load(),Render() and handleInput() etc. But I get 107 warnings and 30 some errors am I just not understanding a somthing or could you tell me what I may be missing.here is the header for the only two engines I have right now:#ifndef _CENGINE_H_#define _CENGINE_H_#include "Core.h"//base engineclass cEngine {protected:public:cEngine(){}//load needed stuff here~cEngine(){}//destroy whatevervirtual void Load(){};virtual void HandleInput(){};//handles user input, duhvirtual void PreFrame(){};//physics collision dection etcvirtual void Render(){};//calls render spriteHINSTANCE hInst; IDirect3DDevice8 *pD3Device; ID3DXSprite *pSprite;};//menu engineclass cMenuEngine : cEngine{public:cMenuEngine(HINSTANCE hInst, IDirect3DDevice8 *pD3Device, ID3DXSprite *pSprite){hInst=hInst;pD3Device=pD3Device;pSprite=pSprite;Load();}~cMenuEngine();void Load();void HandleInput();void PreFrame();void Render();};#endif I implement cMenuEngine''s functions in its .cpp so shouldn''t they just override the base class. The effect I want is so when I call process from my stateManager I can call these virtual functions with a pointer, make sense.The warnings I am getting say for every funtion in D3DXSPRITE class etc, and any other device I create in the virtual funtionspure virtual function was not definedIf you need more info let me know and thanks in advance-Dapeos 
  I''m not sure if this will work, but try changing the base class virtual function definitions to this:virtual void Load() = 0; ;  If you are intending cEngine (and the others) to be abstract base classes you may want to make its methods pure virtual, with:virtual void Load(void) = 0;As it will prevent creation of actual cEngine objects and makes a little clearer what you are going for. However:quote:The warnings I am getting say for every funtion in D3DXSPRITE class etc, and any other device I create in the virtual funtionspure virtual function was not definedIf you need more info let me know and thanks in advanceIt sounds like you DO have a pure virtual function declared some place, but never defined. You''ll have to rephrase that last bit, because I don''t understand. Copy and paste the first few warnings/errors from the output window.Also make sure your destructor for the base classes are virtual. ;  I am on my way to work so I won''t be able to check back till tonight but here yeah go Heres my state manager header where I am getting the errors#ifndef _CSTATEMANAGER_H_#define _CSTATEMANAGER_H_#include "Core.h"class cStateManager{protected: struct sState{cEngine *EnginePtr;sState *Next;};sState *Parent;public :cStateManager() {Parent=NULL;}~cStateManager();BOOL Pop();BOOL Process();void Push(cEngine *EnginePtr);};#endif Here is the implementation of my derived class cMenuEngine:void cMenuEngine::Load(){D3DXCreateTextureFromResourceEx(pD3Device,hInst,    MAKEINTRESOURCE(TEXTURE_MENU),    D3DX_DEFAULT,    D3DX_DEFAULT,    D3DX_DEFAULT,    0,    D3DFMT_A8R8G8B8,    D3DPOOL_MANAGED,    D3DX_FILTER_TRIANGLE,    0,    NULL,//color key for transparent textures    NULL,    NULL,    &ptMenu);D3DXVECTOR2location;RECTSrcRect;location.x=300;location.y=100;SrcRect.left=0;SrcRect.right=512;SrcRect.top=0;SrcRect.bottom=100;int width=SrcRect.right-SrcRect.left;int height=SrcRect.bottom-SrcRect.top;mSprite.addSprite(ptMenu,location,SrcRect,width,height);}void cMenuEngine::HandleInput(){}void cMenuEngine:reFrame(){}void cMenuEngine::Render(){pD3Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0,0,0,255), 1.0f, 0);pD3Device->BeginScene();mSprite.renderSprite(pSprite);pD3Device->EndScene();pD3Device->Present(NULL, NULL, NULL, NULL);}Here are some of the errors and warnings:c:\visualstudioprojects\templates\winmain.cpp(57) : warning C4259: ''long __stdcall ID3DXSprite::DrawTransform(struct IDirect3DTexture8 *,const struct tagRECT *,const struct D3DXMATRIX *,unsigned long)'' : pure virtual function was not defined   c:\dxsdk\include\d3dx8core.h(194) : see declaration of ''DrawTransform''c:\visualstudioprojects\templates\winmain.cpp(57) : warning C4259: ''long __stdcall ID3DXSprite::End(void)'' : pure virtual function was not defined   c:\dxsdk\include\d3dx8core.h(198) : see declaration of ''End''c:\visualstudioprojects\templates\winmain.cpp(57) : warning C4259: ''long __stdcall ID3DXSprite::OnLostDevice(void)'' : pure virtual function was not defined   c:\dxsdk\include\d3dx8core.h(200) : see declaration of ''OnLostDevice''c:\visualstudioprojects\templates\winmain.cpp(57) : warning C4259: ''long __stdcall ID3DXSprite::OnResetDevice(void)'' : pure virtual function was not defined   c:\dxsdk\include\d3dx8core.h(201) : see declaration of ''OnResetDevice''cEngine.cppc:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800c:\visualstudioprojects\templates\cstatemanager.h(7) : error C2143: syntax error : missing '';'' before ''*''c:\visualstudioprojects\templates\cstatemanager.h(7) : error C2501: ''cEngine'' : missing storage-class or type specifiersc:\visualstudioprojects\templates\cstatemanager.h(7) : error C2501: ''EnginePtr'' : missing storage-class or type specifiersc:\visualstudioprojects\templates\cstatemanager.h(18) : error C2061: syntax error : identifier ''cEngine''Error executing cl.exe.The core header includes all headers except WinMain so they are aware of each other thanks again I will check back to night.-Dapeos ;  What is line 57 in winmain.cpp?It seems youre using ID3DXSrite directly somewhere instead of a pointer.   [edited by - VolkerG on February 12, 2004 7:14:02 PM]