Thread: [C++] Challenge
View Single Post
Old 01-16-2004, 04:04 PM   #3 (permalink)
n0nsensical
Junkie
 
Location: San Francisco
You mean like this?

Code:
#include <iostream>
using namespace std;

class CFoo
{
	public:
		void func1() { cout << "func1 for CFoo at " << this << endl; }
		void func2() { cout << "func2 for CFoo at " << this << endl; }
};

typedef void (CFoo::*FooMethod)();

int main()
{
	FooMethod methods[2];
	methods[0] = &CFoo::func1;
	methods[1] = &CFoo::func2;
	CFoo foo;
	(foo.*methods[0])();
	(foo.*methods[1])();
	return 0;
}
What's up with the double spacing on that? I don't know.

Last edited by n0nsensical; 01-16-2004 at 04:08 PM..
n0nsensical is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46