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.