Hi,
I am bit confused with the concept of pointer to a data member of a class.
In the below program what actually will the pointer variable be storing? When i tried printing the value of address I got value 1, Whatt does it mean?
class A{
public:
int d;
};
void main(void)
{
int A::*p = &(A::d);
}
I tried creating an object of class A and assigning the address of the data member to p then also my VC compiler is throwing error 'cannot convert from 'int *' to 'int A::*''. Why this error is thrown when b is of type A. Same with the gcc compiler also.
class A{
public:
int d;
};
void main(void)
{
A bb;
bb.d = 10;
int A::*p = &(A::d);
p = &(bb.d);
}