The Evolution of C++ Type Casting: From C’s ‘One-Size-Fits-All’ to C++’s ‘Four Surgical Knives’

The Evolution of C++ Type Casting: From C's 'One-Size-Fits-All' to C++'s 'Four Surgical Knives'

The Evolution of C++ Type Casting: From C’s ‘One-Size-Fits-All’ to C++’s ‘Four Surgical Knives’ Stop using<span>(T)</span>! A detailed explanation of<span>static_cast</span>, <span>dynamic_cast</span>, <span>const_cast</span>, and <span>reinterpret_cast</span> Introduction: The ‘Simple and Brutal’ Hammer of C In the programming practices of C and early C++, we relied on a ‘universal’ type conversion method—the C-style cast. Whether converting a<span>float</span> to … Read more

C++ Programming Tips: Using Type Casting Operators

C++ Programming Tips: Using Type Casting Operators

Type casting is an operation that we should avoid, but most of the time we have to perform it. The most common way we use is to enclose the desired type in parentheses, but this is not recommended. The “(type)” casting intention is unclear, whether it is casting between two unrelated objects, removing const, or … Read more

C++ Knowledge Architecture Diagram

C++ Knowledge Architecture Diagram

There is also a “C Language Knowledge Architecture Diagram” Download link for the dual high-definition images: http://down.51cto.com/data/2239071 Memory Alignment: http://11142019.blog.51cto.com/11132019/1846832 Diamond Inheritance: http://11142019.blog.51cto.com/11132019/1846836 C++ Object Model & Virtual Function Table: http://11142019.blog.51cto.com/11132019/1846838 Deep Copy and Shallow Copy: http://11142019.blog.51cto.com/11132019/1846840 String Implementation: http://11142019.blog.51cto.com/11132019/1846841 Copy on Write: http://11142019.blog.51cto.com/11132019/1846842 New/Delete and New[]/Delete[]: http://11142019.blog.51cto.com/11132019/1846844 Smart Pointers: http://11142019.blog.51cto.com/11132019/1846846 Circular References & Custom … Read more