this pointer in struct's constructor

Hello,
We read in the books that the struct in C++ is almost the same as the class except in the access specifiers where the default in class is private but the default in struct is public.
In a class, if the name of the constructor's argument is the same as the instance variable, we can do:

1
2
3
4
class A {
public:
int x;
A(int x) {this ->x = x;}};


My question is, why this pointer does not work in struct? For example, the code below does not work.

1
2
3
struct A {
int x;
A(int x) {this ->x = x;}};

I don't believe you. http://ideone.com/FMHVbN

Consider also http://ideone.com/wVRaTa
You are right. Thank you !!
I am not sure what was going on.
Topic archived. No new replies allowed.