|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dynamic_cast <new_type> (expression)
reinterpret_cast <new_type> (expression)
static_cast <new_type> (expression)
const_cast <new_type> (expression)
(new_type) expression
new_type (expression)
|
|
Null pointer on second type-cast. |
相容性說明:此類 `dynamic_cast` 需要*執行時型別資訊 (RTTI)* 來跟蹤動態型別。某些編譯器支援此功能作為一個預設停用的選項。需要啟用此功能才能使使用 `dynamic_cast` 的執行時型別檢查與這些型別正確工作。 |
|
|
|
|
|
|
|
|
sample text |
typeid (expression)
|
|
a and b are of different types: a is: int * b is: int |
|
|
a is: class Base * b is: class Base * *a is: class Base *b is: class Derived |
![]() 多型 | ![]() 目錄 | ![]() 異常 |