Short example of problem I have:
class A{
public:
int x[10];
};
int main(){
int A::*pointer = &A::x;
A a;
a.*pointer = 3;
return 0;
}
I got an error: cannot convert from 'int (A::* )[10]' to 'int A::* ' in second line of 'main()'
I tried to remove '&' from this line because x is an array so the name of array (without square brackets) like A::x should return it's adress (in this case shift in A class), but now I got an error like this:
illegal reference to non-static member 'A::x'
Why compiler thinks I want to convert something? I just want to create a pointer to int array x[10], member of A class.
Could you help?