C++ 關鍵字: struct
來自 cppreference.com
[編輯] 用法
(C++11 起) |
- 如果在作用域中存在與非聯合類型別名稱相同的函式或變數,可以在名稱前加上
struct
以消除歧義,從而形成闡明型別說明符。
[編輯] 示例
執行此程式碼
struct Foo; // forward declaration of a struct struct Bar // definition of a struct { Bar(int i) : i(i + i) {} int i; }; enum struct Pub // scoped enum, since C++11 { b, d, p, q, }; int main() { Bar Bar(1); struct Bar Bar2(2); // elaborated type }
[編輯] 參閱
(C++11 起) |