Following c++ code compiles using g++. I'm a bit curious about how name a is resolve in the constructor
#include <cstdio>
struct A {
A(int a) : a(a) { };
const int a;
};
int main() {
A a(10);
printf("%d\n", a.a);
return 0;
}
Following c++ code compiles using g++. I'm a bit curious about how name a is resolve in the constructor
#include <cstdio>
struct A {
A(int a) : a(a) { };
const int a;
};
int main() {
A a(10);
printf("%d\n", a.a);
return 0;
}