|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
![]() 多态 | ![]() 目录 | ![]() 异常 |