Displaying 1 result from an estimated 1 matches for "callmemberfunct".
2003 Apr 29
4
Bug in g++ 2.95.4 (Pointer to member functions)
...ude <iostream>
class Class {
public:
void M1 (void) { cout << "M1" << endl; };
void M2 (void) { cout << "M2" << endl; };
void M3 (void) { cout << "M3" << endl; };
};
typedef void (Class::*ClassMemberFn)(void);
#define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember))
int main (int argc, char* argv[]) {
Class obj;
// This works fine: Array size == 2
ClassMemberFn a[2] = { &Class::M1, &Class::M2};
for (unsigned int i=0; i<2; ++i) {
callMemberFunction (obj, a[i]) ();
}
// This will cause th...