OK when I do this ...
CEntity &ref = *this;
It gives me the error ...
error: invalid initialization of reference of type 'CEntity&' from expression of type 'const CEntity'
However, when I put const infront, it is fine with it, yet I still get the same error on the line as I always did...
return new CEntity(ref);
Wait, yeah the const thing is just becasue I declared the function as const.
Now trying the other way ...
We can clearly see that gcc does crack. This is actually what the error says ...
virtual CEntity *clone() const{ CEntity* p = new CEntity(); <--- "note: candidates are: CEntity::CEntity()" (*p) = (*this); return p;}
I find that hard to beleive as right above that function I declared a constructor ...
CEntity::CEntity() { }
I'm using Eclipse so I first thought maybe it's parsing gcc's output wrong, but it isn't. :(
It seems that all the other classes I derived from CEntity have the same strange error as I mentioned before, e.g.
class CItem : public CEntity
{ <--- note: candidates are: CItem::CItem(const CItem&)
... AHHHHHHHHH