This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Address of a member function at an object
- From: "Mustafa Celik" <celikmus at hotmail dot com>
- To: gcc at gnu dot org
- Date: Wed, 09 Oct 2002 16:16:26 -0400
- Subject: Address of a member function at an object
- Bcc:
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