3 回答

TA貢獻1895條經驗 獲得超3個贊
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;

TA貢獻1868條經驗 獲得超4個贊
C++關鍵字
C++關鍵字列表
關鍵字是預先保留的標識符,每個關鍵字都有特殊的含義。我們不能在程序中使用與關鍵字同名的標識符。以下是C++所保留的關鍵字
asm[1]
auto
bad_cast
bad_typeid
bool
break
case
catch
char
class
const
const_cast
continue
default
delete
do
double
dynamic_cast
else
enum
except
explicit
extern
false
finally
float
for
friend
goto
if
inline
int
long
mutable
namespace
new
operator
private
protected
public
register
reinterpret_cast
return
short
signed
sizeof
static
static_cast
struct
switch
template
this
throw
true
try
type_info
typedef
typeid
typename
union
unsigned
using
virtual
void
volatile
while
[1] 為了與其他C++實現保持兼容而保留的,并未實現。在VC環境中,請使用 __asm。
添加回答
舉報