| and | const_cast | if | register | typedef |
| and_eq | default | inline | reinterpret_cast | typeid |
| asm | delete | int | return | typename |
| auto | do | long | short | union |
| bitand | double | mutable | signed | unsigned |
| bitor | dynamic_cast | namespace | sizeof | using |
| bool | else | new | static | virtual |
| break | enum | not | static_cast | void |
| case | explicit | not_eq | struct | volatile |
| catch | export | operator | switch | wchar_t |
| char | false | or | template | while |
| class | float | or_eq | this | xor |
| compl | for | private | throw | xor_eq |
| const | friend | protected | true | |
| continue | goto | public | try |
大致可分為五大類,如下
- 型態指定與範圍相關
- 修飾詞相關
- 控制陳述相關
- 物件管理相關
- 運算子相關
型態指定與範圍相關
型態指定與範圍相關的關鍵字有
- auto
- bool
- char
- class
- double
- dynamic_cast
- enum
- export (GCC 不支援)
- extern
- false
- float
- friend
- inline
- int
- long
- namespace
- reinterpret_cast
- register
- short
- struct
- template
- true
- typedef
- typename
- union
- using
- void
- wchar_t
這裡需要先認識 C++ 分成兩大類內建基本資料型態,整數類型態 (integral types) 及浮點數類型態 (floating-point types) 。整數類型態使用關鍵字 bool 、 char 、 int 、 long 、 short ,其中 bool 表示邏輯上的真假值,其值不是 true 就是 false 。
浮點數類型態則使用關鍵字 double 及 float 。而 void 表示不具任何型態,其餘往後才會陸續介紹。
修飾詞相關
修飾詞 (modifier) 相關的關鍵字有
- const
- const_cast
- mutable
- private
- protected
- public
- signed
- static
- static_cast
- unsign
- virtual
- volatile
修飾詞為宣告 (declaration) 或定義 (definition) 的添加詞,用來標明所宣告或所定義的特性,往後才後陸續介紹各種修飾詞的作用。
控制陳述相關
控制陳述 (control flow) 相關的關鍵字有
- asm
- break
- case
- catch
- continue
- default
- do
- else
- for
- goto
- if
- return
- switch
- throw
- try
- while
控制陳述提供結構化程式設計 (structured programming) 的方法。程式預設以循序結構 (sequence structure) 執行,選擇結構 (selection structure) 及重複結構 (repetition structure) 則使程式能夠將控制權移轉,使程式控制更為簡單。
C++ 另有檢查及例外處理 (exception handling) 的機制,詳細往後才會陸續介紹。
物件管理相關
物件 (object) 管理相關的關鍵字有
- delete
- explicit
- new
- this
- typeid
運算子相關
運算子 (operator) 管理相關的關鍵字有
- and
- and_eq
- bitand
- bitor
- compl
- not
- not_eq
- operator
- or
- or_eq
- sizeof
- xor
- xor_eq
除了 operator 及 sizeof 外,其餘用為運算子的關鍵字都有相同功能的運算符號對應,詳細往後才會陸續介紹。
| 中英文術語對照 | |
|---|---|
| 關鍵字 | keyword |
| 保留字 | reserved word |
| 整數類型態 | integral types |
| 浮點數類型態 | floating-point types |
| 修飾詞 | modifier |
| 宣告 | declaration |
| 定義 | definition |
| 控制陳述 | control flow |
| 結構化程式設計 | structured programming |
| 循序結構 | sequence structure |
| 選擇結構 | selection structure |
| 重複結構 | repetition structure |
| 例外處理 | exception handling |
| 物件 | object |
| 運算子 | operator |
您可以繼續參考
基本概念
標記
基本資料型態
相關目錄
回 C++ 快速導覽
回 C++ 教材
回首頁
參考資料
C++ reference
cplusplus.com
Cprogramming.com C++ Tutorial
C++ Primer, Fourth Edition, Stanley B. Lippman...
本文於 2013 年 1 月更新
沒有留言:
張貼留言