I recall I used to be able to do this and have it work as intended:
class foobar
{
public:
foobar(int x, int y)
{
x = x; //the variables x, y belonging to the class got correctly initialized
y = y;
}
private:
int x, y;
};
The above worked in circa 200x on Microsoft Visual C++ 6.0 and some later versions, I believe.
But now I have to do this on Microsoft Studio 2013 and I have to use this->
, as such:
class foobar
{
public:
foobar(int x, int y)
{
this->x = x; //the other way no longer initializes class vars
this->y = y;
}
private:
int x, y;
};
Was there a language spec change or Microsoft compiler change?