Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 565 Bytes

File metadata and controls

18 lines (11 loc) · 565 Bytes

casting

Prefer C++style casting over old-style, C casts and generally, try to avoid casting, especially dynamic_cast<> as it has very poor performance.

static_cast(object) // Casts an object between similar types, e.g. int to double

reinterpret_cast(object) // Casts an object from a completely different type to another type, e.g. class Foo() { } to char* 

dynamic_cast(object) // Casts between inheritance hierarchies, e.g. from Base pointer to Derived to Derived pointer

const_cast(object) // Casts a way the const of an object