This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem with pointers to function
- To: gcc at gcc dot gnu dot org
- Subject: Problem with pointers to function
- From: Pascal Francq <pfrancq at ulb dot ac dot be>
- Date: Tue, 15 Aug 2000 17:56:53 +0200
- Organization: Université Libre de Bruxelles
Hi,
I have compiling errors (gcc 2.95.2) with the following code whand I try to
assign a member function to a pointer:
typedef void(*FuncType)(unsigned int);
FuncType Func;
class Dummy
{
public:
void DoSomething(unsigned int i)
{
// Do some stuff on the dummy class.
}
Dummy(void)
{
Func=&Dummy::DoSomething();
}
};
main(void)
{
Dummy var;
Func(5); // I will to call var.DoSomething(5)
}
--
Ir. Pascal Francq
Researcher
Université Libre de Bruxelles
Faculty of Applied Mechanics
Avenue F.D. Roosevelt, 50
CP 165/41
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 27 10