I have interface that looks like this :
class GameObject
{
public:
virtual ObjType getType() = 0;
virtual void setType(ObjType ot) = 0;
protected:
ObjType objtype;
};
then i have class that implement this interface
class SpriteObject : public GameObject
{
public:
SpriteObject();
virtual ~SpriteObject();
ObjType getType() { return objtype; }
void setType(ObjType ot) { objtype = ot; }
private:
};
class LayerObject : public GameObject
{
public:
LayerObject ();
virtual ~LayerObject ();
ObjType getType() { return objtype; }
void setType(ObjType ot) { objtype = ot; }
private:
};
in the main class i have function which i try to pass the SpriteObject to That looks like this :
bool HelloWorld::NodeAction(GameObject* &pGameObj)
{
}
when i try to do :
SpriteObject *pSpriteObject = new SpriteObject();
NodeAction(pSpriteObject);
im getting this error:
error C2664: 'bool HelloWorld::NodeAction(GameObject *&)' : cannot convert argument 1 from 'SpriteObject *' to 'GameObject *&'
In the end i want to have global function that can get different Objects that implement GameObject .