I am trying to understand the sequence in the error that occurs in this program:
Output 10 10 . I have indicated 4 points of the program, but (3) is my biggest problem:
x usually retrieved from within a member function.x object is retrieved using the scope operator and the value l is returned to object x .- Given
A::x , int lvalue is returned in (2), why then &A::x does not return int* , but instead returns int A::* ? The scope operator takes precedence over the & operator, so you should start A::x , returning the value of int l before the address is taken. those. should it be exactly the same as &(A::x) ? (By the way, adding brackets really works). - A little different, of course, is the scope operator, which refers to a member of the class, but without the object to which it belongs.
So, why exactly A::x does not return the address of the object x , but instead returns the address of the element, ignoring the priority :: to & ?
c ++ c ++ 11 pointer-to-member
Antielephant
source share