The code is really simple (but I am a newbie so I have no idea what I am doing wrong) :
#include<iostream>
#include<string>
void PrintEntity(Entity* e);
class Entity
{
public:
int x,y;
Entity(int x, int y)
{
Entity* e= this;
e-> x=x;
this->y=y;
PrintEntity(this);
}
};
void PrintEntity(Entity* e)
{
// *Do stuff*
}
int main()
{
return 0;
}
My understanding of the error is that I cannot declare the function PrintEntity before of the class Entity. But even if I would declare the function below the class it would be a problem since in the Constructor I am calling the function PrintEntity.
So I am quite stuck . Can anybody explain to me what I am doing wrong please?