I want to be able to have a method that returns something and cannot change member variables like in a normal class, for example:
class blah
{
const int& Get_X() const
{
return m_x;
}
private:
int m_x = 0;
};
but in my singleton class, it won't let me compile something like this. It gives me this error message:
error: static member function 'static const SDL_Point& Events::Mouse_Pos()' cannot have cv-qualifier
the code in the header file is this:
static const SDL_Point& Mouse_Pos() const;
because I want to be able to (in the .cpp file) declare something such as
const SDL_Point& Events::Mouse_Pos() const
{
return Get_Instance().m_Mouse_Pos;
}
What am I missing? Or can you not do this?