On the C ++ four types of conversion

1.interpret_cast

Almost any type can be converted, there is no guarantee of results. -> not recommended

2.const_cast

Const type generally used to convert

3.static_cast

Basic data type conversion, an implicit conversion, void * pointer to any turn, polymorphic conversion, down is not guaranteed

4.dynamic_cast

Only for virtual functions, i.e. the conversion between the vertical succession, up-conversion security
down conversion failure:.. A pointer for return NULL; b For reference, an exception is thrown

Released seven original articles · won praise 1 · views 26

Guess you like

Origin blog.csdn.net/weixin_45793136/article/details/105125424