S
Swengtoo
Hi,
The following code compiles and runs great using Visual C++ 6.0:
a.cpp
-----
void A:oSomething() {
cout << "test";
}
// notice: A:oSomething() is *not* a static member function
b.hpp
-----
typedef void (A::*AFUNCPTR) ();
class B {
void ForAll(AFUNCPTR funcptr);
}
b.cpp
-----
void B::ForAll(AFUNCPTR funcptr) {
A *pNode = GetList().First();
while (pNode) {
(pNode->*funcptr)();
pNode = pNode->Next();
}
}
void B:oIt() {
ForAll(A:oSomething);
}
But using gcc 3.0.4 and 3.2.3 it produces the following error message:
b.cpp: In member function `void B:oIt()':
b.cpp:238: no matching function for call to `B::ForAll(<unknown type>)'
b.hpp:92: candidates are: void B::ForAll(void (A::*)())
gmake: *** [b.o] Error 1
Any idea why?
Thanks in advance,
Swengtoo
The following code compiles and runs great using Visual C++ 6.0:
a.cpp
-----
void A:oSomething() {
cout << "test";
}
// notice: A:oSomething() is *not* a static member function
b.hpp
-----
typedef void (A::*AFUNCPTR) ();
class B {
void ForAll(AFUNCPTR funcptr);
}
b.cpp
-----
void B::ForAll(AFUNCPTR funcptr) {
A *pNode = GetList().First();
while (pNode) {
(pNode->*funcptr)();
pNode = pNode->Next();
}
}
void B:oIt() {
ForAll(A:oSomething);
}
But using gcc 3.0.4 and 3.2.3 it produces the following error message:
b.cpp: In member function `void B:oIt()':
b.cpp:238: no matching function for call to `B::ForAll(<unknown type>)'
b.hpp:92: candidates are: void B::ForAll(void (A::*)())
gmake: *** [b.o] Error 1
Any idea why?
Thanks in advance,
Swengtoo