2014/12/24

[C++] static_cast & dynamic_cast

以往都用(int) variable來強迫轉型,新的C++裏頭似乎比較鼓勵用static_cast
dynamic_cast在物件轉型時會檢查是否由父類別轉為子類別,接著才進行轉換

Reference:
http://windsplife.blogspot.tw/2010/09/cstaticcast-dynamiccast-reinterpretcast.html