Member function using pointer to member function
Volker Boerchers
boercher@physik.uni-bremen.de
Mon Sep 14 04:00:00 GMT 1998
Hello,
the following code is accepted by gcc version 2.7.2.1:
01 #include <iostream.h>
02 class A
03 {
04 double f(double t);
05 double ff(double (A::*func)(double), double t);
06 public:
07 double fff(double t);
08 };
09 double A::f(double t)
10 {
11 return t;
12 }
13 double A::ff(double (A::*func)(double), double t)
14 {
15 return func(t);
16 }
17 double A::fff(double t)
18 {
19 return ff(&f, t);
20 }
21 int main()
22 {
23 A a;
24 cout << a.fff(3.) << "\n";
25 return 0;
26 }
Egcs ( egcs-2.91.57 19980901 (egcs-1.1 release) )
produces this error message:
A.cc: In method `double A::ff(double (A::*)(double), double)':
A.cc:15: must use .* or ->* to call pointer-to-member function in `func
(...)'
Who is wrong; what can i do to make it work?
Any help is appreciated
Volker
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Volker B"orchers, Uni Bremen, NW1, Raum 03160, Tel. +49-421-218-4522
mailto://boercher@physik.uni-bremen.de
http://hix.physik.uni-bremen.de/~boercher
More information about the Gcc
mailing list