This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Address of a member function at an object




Hello,
Can I get the address of a member function with the code below?

class Fred
{
public: void foo();
};

Fred fred;

void (*fp)() = &fred.foo;
// or
// void(Fred::*fp)() = &fred.foo;
// or ...

It doesn't compile with gcc 2.95.1, though I think it used to work with earlier compilers. It works for the following code:

void (Fred::*fp)() = &Fred::foo;

Is this a restriction, is there a work-around to get the address of a member function at that object?


Thanks,


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]