   C++ Polymorpism issue( maybe ?)
  Hello all,I have a C++ issue I could really use some help on.  The game I'm working on has a base class Entity, with two subclasses NPC and Player.  Entity does include some virtual methods, so my understanding is that this makes it an abstract class, and hence unable to be instantiated as its own type.What I am trying to do is to pass and return Entity pointers from a set of class functions that deal with Players and NPC's locations on a map.  The data I would like from them is not specific to either NPC or Player, it is contained in the Entity base class.  Hence the use of Entity pointers.  Unfortunately, when trying to compile these functions I get a syntax error "identifier 'Entity'".  I have included Entity.h in this class.My only suspision is that since Entity is an abstract class, it doesn't want me to hold pointers to Entities.  But that doesn't make sense to me; if I can't hold pointers to the base class, how am I supposed to use polymorphism in the first place?Pleae let me know if anyone can tell what I'm doing wrong here.  If you need more information I'd be glad to oblige.  Thanks, jujumbura   
  Sounds like a syntactic issue rather than a conceptual one. Perhaps a circular include? Post the code for your Entity class, the code that's producing the error message (including #includes) and the exact error message.   ;  Could you refresh me on what tag allows me to create the scrolling code window again?   ;Quote:Original post by jujumburaCould you refresh me on what tag allows me to create the scrolling code window again?[ source][ /source]   ;  You can instantiate a class with virtual methods as long as they aren't pure virtual ones. ieclass A {public:virtual void method(void){}};A a;is ok,class B{public:virtual void method(void)=0;};B b;will fail.   ;  This is the header for the class that I want to hold Entity pointers:#ifndef MAPTILE_H#define MAPTILE_H#include "Common.h"#include "Sprite.h"#include "Entity.h"class MapTile{public:MapTile();~MapTile();bool Init( LPDIRECT3DDEVICE9 pd3dDevice, Common* pCommonFunc, const char *sTextureName,   float fX, float fY, float fZ, float fWidth, float fHeight,    float fTUBase, float fTVBase, float fTUWidth, float fTVHeight,   INT32 iTileX, INT32 iTileY, UINT8 ui8Attributes );float GetWorldX();float GetWorldY();float GetWorldZ();INT32 GetTileX();INT32 GetTileY();Sprite* GetSprite();UINT8GetAttributes();UINT16GetFlag(int flagNum);voidSetFlags(UINT16 ui16aFlags[]);void SetIsOccupied(bool bIsOccupied, Entity *epOccupier);bool GetIsOccupied();Entity* GetOccupier();void Update(UINT32 uiDeltaTime);void Paint();protected:LPDIRECT3DDEVICE9m_pd3dDevice;Common*m_pCommonFunc;Spritem_sprSprite;INT32m_iTileX;INT32m_iTileY;boolm_bIsOccupied;Entity*m_epOccupier;UINT8m_ui8Attributes;UINT16m_ui16aFlags[6];};#endifAnd this is the header for the Entity itself:#ifndef ENTITY_H#define ENTITY_H#include "Common.h"#include "Sprite.h"#include "Fader.h"#include "TileManager.h"enum MoveDir{MOVE_DIR_LEFT = 0,MOVE_DIR_RIGHT = 1,MOVE_DIR_UP = 2,MOVE_DIR_DOWN = 3};enum Attributes{AttributeEmptySavable= 0,AttributeEmptyNonSavable= 1,AttributeSolid= 2,AttributeLeftSolidSavable= 3,AttributeRightSolidSavable= 4,AttributeTopSolidSavable= 5,AttributeBottomSolidSavable= 6,AttributeTopLeftSolidSavable= 7,AttributeTopRightSolidSavable= 8,AttributeBottomLeftSolidSavable= 9,AttributeBottomRightSolidSavable= 10,AttributeLeftSolidNonSavable= 11,AttributeRightSolidNonSavable= 12,AttributeTopSolidNonSavable= 13,AttributeBottomSolidNonSavable= 14,AttributeTopLeftSolidNonSavable= 15,AttributeTopRightSolidNonSavable= 16,AttributeBottomLeftSolidNonSavable= 17,AttributeBottomRightSolidNonSavable= 18};class Entity{public:Entity();~Entity();bool Init( LPDIRECT3DDEVICE9 pd3dDevice, Common* pCommonFunc,   float fX, float fY, float fZ, float fWidth, float fHeight, bool isActor );float GetWorldX();float GetWorldY();float GetWorldZ();INT32 GetTileX();INT32 GetTileY();void SetTilePosition(INT32 iX, INT32 iY);void SetTileManager(TileManager *ptmTileManager);Sprite* GetSprite();virtual void Move(UINT32 uiDeltaTime) = 0;virtual void Update(UINT32 uiDeltaTime) = 0;virtual void Paint() = 0;protected:boolTestMoveDestination(MoveDir desiredDir);LPDIRECT3DDEVICE9m_pd3dDevice;Common*m_pCommonFunc;Sprite*m_psprSprite;TileManager*m_ptmTileManager;INT32m_iTileX;INT32m_iTileY;INT32m_iDirection;};#endifThe first compiler error is at "SetIsOccupied", which takes an Entity pointer.  That is the "sytax error: identifier Entity" message.  The rest seem related to the fact that it has no idea what an entity is.;  Looks like it's pure virtual then, because Entity has two of those methods.  So does that mean I can't even hold a pointer to Entity because of that?   ;  Passing around pointers to classes with pure virtuals is totally acceptable. Where is the definition of SetIsOccupied?   ;  It's pretty basic.  Just sets some instance variables.void MapTile::SetIsOccupied(bool bIsOccupied, Entity *epOccupier){m_bIsOccupied = bIsOccupied;m_epOccupier = epOccupier;};  What exactly is a "circular include" by the way?  I can see that MapTile.h includes Entity.h, and Entity.h includes MapTile.h.  Is this my problem?  And if so, how should I make them accessible to one another?   