Address of member (pointer syntax)

M

Marcus

Out of curiosity... Does anybody know why we use &Class::member instead
of Class::&member? The second form is more consistent with ::*, .* and
->*.
 
V

Victor Bazarov

Marcus said:
Out of curiosity... Does anybody know why we use &Class::member instead
of Class::&member? The second form is more consistent with ::*, .* and
->*.


I think it was first without the ampersand (Class::member), but then the
lookup rules got complicated and the need for the ampersand appeared.
Also, it's not very visible in the code if you write

ClassA::ClassB::ClassC::&member

compared to

&ClassA::ClassB::ClassC::member

.... But those are just wild speculations. Try asking in 'comp.std.c++',
maybe they remember...

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top