Possible Duplicate:
C++ equivalent of “super”?
Is it possible to call a base class member function in a sub class, without knowing name of base class? (something like use super keyword in java)
Possible Duplicate:
C++ equivalent of “super”?
Is it possible to call a base class member function in a sub class, without knowing name of base class? (something like use super keyword in java)
C++ doesn't have a standard equivalent for super
keyword. But there is a microsoft specific one __super
which I think achieves the same thing if you are using visual studio.
// deriv_super.cpp
// compile with: /c
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)
}
};
Refer: msdn