名稱空間
變體
操作

C++ 關鍵字

來自 cppreference.com
< cpp‎ | 關鍵字
 
 
C++ 語言
表示式
替代表示
字面量
布林型 - 整型 - 浮點型
字元型 - 字串型 - nullptr (C++11)
使用者定義 (C++11)
工具
屬性 (C++11)
型別
typedef 宣告
類型別名宣告 (C++11)
型別轉換
記憶體分配
類特有的函式屬性
explicit (C++11)
static

特殊成員函式
模板
雜項
 
 

[編輯] 用法

(C++11 起)

[編輯] 示例

class Foo; // forward declaration of a class
 
class Bar  // definition of a class
{
public:
    Bar(int i) : m_i(i) {}
private:
    int m_i;
};
 
template<class T> // template argument
void qux()
{
    T t;
}
 
enum class Pub // scoped enum, since C++11
{
    b, d, p, q
};
 
int main()
{
    Bar Bar(1); // variable Bar hides type Bar
    Bar Bar2(2); // compiler error
    class Bar Bar3(3); // elaborated type
}

[編輯] 另請參閱

(C++11 起)
(C++20 起)
English 日本語 中文(简体) 中文(繁體)