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]

Problem with pointers to function


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

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