Pointer-to-member Strange behaviour

Alexandre Oliva oliva@dcc.unicamp.br
Sat Dec 6 19:59:00 GMT 1997


Benoit Lavigne writes:

> The following code won't compile, and I can't figure out why...

>   ptm fn; // pointer to member function
>   int Execute() {
>     return (d_mgr_p->*fn);

If you intend to call invoke the member function, you must add parens:
      return (d_mgr_p->*fn());

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



More information about the Gcc mailing list