컴퓨터/C++_STL
멤버 함수의 포인터를 배열에 넣는 방법
adnoctum
2009. 12. 27. 23:33
선언
[code cpp]
bool (CTest::*my_arr_of_func_prt[])(int) = { CTest::Up, CTest::Down, CTest::Left, CTest::Right };
[/code]
사용
[code cpp]
CTest t;
(t.*my_arr_of_func_prt[1])(10); // t.Down(10); 과 같다.
[/code]
만약 현재 클래스가 CTest 라면,
[code cpp]
(this->*my_arr_of_func_prt[1])(10); // t.Down(10); 과 같다.
[/code]
[code cpp]
bool (CTest::*my_arr_of_func_prt[])(int) = { CTest::Up, CTest::Down, CTest::Left, CTest::Right };
[/code]
사용
[code cpp]
CTest t;
(t.*my_arr_of_func_prt[1])(10); // t.Down(10); 과 같다.
[/code]
만약 현재 클래스가 CTest 라면,
[code cpp]
(this->*my_arr_of_func_prt[1])(10); // t.Down(10); 과 같다.
[/code]