Forward Declaration of Class breaks the game
Did you tried debugging it and see where it crash? My guess is a null or uninitialized pointer somewhere.
Yep, use the debugger. Is the theGame pointer valid when you call CMainCharacter::Update?
Also, you will want a virtual destructor for CMainGame since you have virtual functions in the class.
And why is a CMainGame derived from Mathematics? The game IS A Mathematics??? I suspect that is an interface though (i.e. all virtual functions, so the game implements Mathematics), but I can't see any reason why maths functions would be in a virtual interface...
Mathematics class just contains random math functions like getting distance, random numbers etc.
Oh I didn't know I need virtual constructor when I have virtual functions. Thank you I'll add that.
....
}
What value does theGame pointer have? It might be initialized to 0xCDCDCDCD or something like that, in which case, it's not null, but is not pointing to valid memory location either.
Did you make sure those pointers are set to NULL when your program start?
theGamepointer value is 0x00a24c20 just before it hits line "if (theGame->isKeyHold(SDLK_d))"
Is that the same as the 'this' pointer from any of your CMainGame functions while they are executing?
How are you calling CMainCharacter::Update?
Hmm, I dunno. The this pointer passed to MainCharacter::Update should be the same as the theGame pointer received inside CMainCharacter::Update...
Have you tried doing a full rebuild?