| | | Guest |  |
| Posted: Tue Sep 23, 2008 12:29 am Post subject: Class member access |  |
| |  | |
Hi,
This is with reference to N2691. I am slightly confused with the standards document and hence request validation of my thinking process.
a) With respect to $3.4.5-
struct A{int m;}
A a, *pa; a.m = 2;
pa = &a; pa->m = 2;
My understanding is that in the expression a.m = 2, 'a' is the object expression, and 'm' is the id-expression. In this case id-expression is an unqualified id. Similary in the expression, pa->m = 2, 'pa' is the object pointer expression, and 'm' is the id-expression, which again is an unqualified id. Is this correct?
b) With reference to the algorithm in $10.2 regarding the lookup set for member name lookup, consider the code
struct base{ virtual void show(){}; };
struct derived1 : base{ void show(){} };
struct derived2 : base{ void show(int x){} using base::show; };
struct derived12 : derived1, derived2{ };
int main(){ derived12 d; derived2 *p = &d; p->show(); }
In this case, the final merged declaration set has derived2::show(int) and base::show() and hence the actual call is ambiguous. However the standard is not clear IMHO about the state of the final subobject set. Does the final subobject set have only "derived2" subobject or does it also have "base" subobject.
Regards, Dabs.
-- [ See LINK for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |
|