來源:http://blog.sina.com.cn/s/blog_498c7cd50100nwnz.html
Visual C++ 8中的__super關鍵字
工作中看到別人的代碼有__super::SetWindowSize()這樣的代碼,查詢了一下備忘在這里。
Visual Studio 2005中新增了__super關鍵字,它代表本類的基類,因此可以像下面這樣使用:
struct B1 {
void mf(int) {}
};
struct B2 {
void mf(short) {}
void mf(char) {}
};
struct D : B1, B2 {
void mf(short) {
__super::mf(1); // Calls B1::mf(int)
__super::mf('s'); // Calls B2::mf(char)
}
};
它還可以配合using語句使用,比如using __super::type_define;這樣的。