關(guān)鍵字是保留字。我們不能將其用作變量名稱,常量名稱等。下面給出了C語(yǔ)言中可用的C++語(yǔ)言中的32個(gè)關(guān)鍵字列表。
| auto | break | case | char | const | continue | default | do |
|---|---|---|---|---|---|---|---|
| double | else | enum | extern | float | for | goto | if |
| int | long | register | return | short | signed | sizeof | static |
| struct | switch | typedef | union | unsigned | void | volatile | while |
下面給出了在C語(yǔ)言中不可用的30個(gè)C++語(yǔ)言關(guān)鍵字的列表。
| asm | dynamic_cast | namespace | reinterpret_cast | bool |
|---|---|---|---|---|
| explicit | new | static_cast | false | catch |
| operator | template | friend | private | class |
| this | inline | public | throw | const_cast |
| delete | mutable | protected | true | try |
| typeid | typename | using | virtual | wchar_t |