I have a problem in MSVC ++ 2008, where VS2008 throws this compilation error:
error C2509: 'render' : member function not declared in 'PlayerSpriteKasua'
Now, what confuses me is that render () is defined, but in an inherited class.
The class definition works as follows:
SpriteBase -Inherited By-> PlayerSpriteBase -Inherited By-> PlayerSpriteKasua
So, the corrected version of SpriteBase.h is this:
class SpriteBase { public:
PlayerSpriteBase.h:
class PlayerSpriteBase : public SpriteBase { public: virtual void pose() = 0; virtual void knockback(bool Direction) = 0; virtual int getHealth() = 0; };
And finally, PlayerSpriteKasua.h:
class PlayerSpriteKasua : public PlayerSpriteBase { public: };
I know that it has no members, but that is simply because I could not add them. The same goes for PlayerSpriteBase; there was another matter.
Code in PlayerSpriteKasua.cpp:
#include "../../../MegaJul.h" //Include all the files needed in one go void PlayerSpriteKasua::render(long long ScreenX, long long ScreenY) { return; } void PlayerSpriteKasua::think() { return; } int PlayerSpriteKasua::getHealth() { return this->Health; }
When I type, say void PlayerSpriteKasua:: , Intellisense pops up, listing all the members of PlayerSpriteBase and SpriteBase just fine, but it fails when compiling, as I said above.
Is there any special reason why I get this error?
PlayerSpriteBase.cpp is empty and has nothing yet.
SpriteBase.cpp has many function definitions for SpriteBase and uses the same format as PlayerSpriteKasua.cpp:
void SpriteBase::died() { return; }
- an example.