Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Member function pionters in C++ Pin
Erudite_Eric12-Sep-11 20:39
Erudite_Eric12-Sep-11 20:39 
GeneralRe: Member function pionters in C++ Pin
jschell13-Sep-11 11:38
jschell13-Sep-11 11:38 
GeneralRe: Member function pionters in C++ Pin
Erudite_Eric13-Sep-11 22:43
Erudite_Eric13-Sep-11 22:43 
GeneralRe: Member function pionters in C++ Pin
jschell14-Sep-11 13:16
jschell14-Sep-11 13:16 
AnswerRe: Member function pionters in C++ Pin
TheGreatAndPowerfulOz12-Sep-11 12:18
TheGreatAndPowerfulOz12-Sep-11 12:18 
GeneralRe: Member function pionters in C++ Pin
Erudite_Eric12-Sep-11 20:34
Erudite_Eric12-Sep-11 20:34 
GeneralRe: Member function pionters in C++ Pin
TheGreatAndPowerfulOz13-Sep-11 12:55
TheGreatAndPowerfulOz13-Sep-11 12:55 
AnswerRe: Member function pionters in C++ [modified] Pin
Stefan_Lang13-Sep-11 23:01
Stefan_Lang13-Sep-11 23:01 
The problem is that operator*(MyFunc) is ambiguous, whereas operator->*(MyFunc) is not. You may have missed the point that this->*pProc is not equivalent to this->(*pProc) or (*this).(*pProc). neither of the latter versions would compile, because they are just as ambigous as (*pProc)!

A member function pointer isn't simply an address, it is a small struct that contains various bits of information that are needed to determine the actual function address, depending on whether the function is static, inline, virtual, or ordinary, whether the function type was defined in a base class or not, and maybe other factors as well. The compiler therefore wouldn't be able to tell if by invoking operator* you want to access these struct members, or rather call a function whose address is encoded by that struct!

At least that is my (incomplete) understanding of the matter. I may not be entirely correct, but you're free to google for more details. I've found 'Pointers to member functions' a very insightful article on the matter, although I couldn't pinpoint a concise answer to your question in there.

P.S.: I've just thought to search for this topic on CP and found this article. Just like the above link it explains a lot about member function pointers and their (lack of) use, but you might not like the article as much because it makes a point of how utterly useless member function pointers really are, except for the one thing this article is about: fast delegates. Wink | ;)

modified on Wednesday, September 14, 2011 5:25 AM

GeneralRe: Member function pionters in C++ Pin
Erudite_Eric14-Sep-11 20:17
Erudite_Eric14-Sep-11 20:17 
QuestionDrag n Drop not accepting file outside of application Pin
TheHelenLee11-Sep-11 19:31
TheHelenLee11-Sep-11 19:31 
AnswerRe: Drag n Drop not accepting file outside of application [modified] Pin
Code-o-mat11-Sep-11 22:25
Code-o-mat11-Sep-11 22:25 
GeneralRe: Drag n Drop not accepting file outside of application Pin
TheHelenLee12-Sep-11 14:36
TheHelenLee12-Sep-11 14:36 
AnswerRe: Drag n Drop not accepting file outside of application Pin
TheHelenLee12-Sep-11 16:18
TheHelenLee12-Sep-11 16:18 
QuestionMicrosecond timer Pin
azhari2411-Sep-11 15:24
azhari2411-Sep-11 15:24 
AnswerRe: Microsecond timer Pin
David Crow11-Sep-11 17:24
David Crow11-Sep-11 17:24 
GeneralRe: Microsecond timer Pin
azhari2412-Sep-11 2:37
azhari2412-Sep-11 2:37 
AnswerRe: Microsecond timer Pin
CPallini11-Sep-11 22:17
mveCPallini11-Sep-11 22:17 
GeneralRe: Microsecond timer Pin
azhari2412-Sep-11 2:38
azhari2412-Sep-11 2:38 
AnswerRe: Microsecond timer Pin
Erudite_Eric12-Sep-11 1:25
Erudite_Eric12-Sep-11 1:25 
GeneralRe: Microsecond timer Pin
azhari2412-Sep-11 2:39
azhari2412-Sep-11 2:39 
AnswerRe: Microsecond timer Pin
azhari2412-Sep-11 3:08
azhari2412-Sep-11 3:08 
GeneralRe: Microsecond timer Pin
Erudite_Eric12-Sep-11 4:14
Erudite_Eric12-Sep-11 4:14 
AnswerRe: Microsecond timer Pin
jschell12-Sep-11 8:40
jschell12-Sep-11 8:40 
GeneralRe: Microsecond timer Pin
enhzflep12-Sep-11 8:48
enhzflep12-Sep-11 8:48 
GeneralRe: Microsecond timer [modified] Pin
Erudite_Eric12-Sep-11 20:42
Erudite_Eric12-Sep-11 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.