Chapter 14. Casting Operators

Operators that change the interpretation of an object are called casting operators.

In this lesson, you will learn:

  • The need for casting operators

  • Why traditional C-style casts are not popular with some C++ programmers

  • The four C++ casting operators

  • Why C++ casting operators are not all-time favorites

What Is Casting?

Casting is a mechanism by which the programmer can temporarily or permanently change the interpretation of an object by the compiler. Note that this does not imply that the programmer changes the object itself—no, he simply changes the interpretation thereof.

The Need for Casting

In a perfectly type-safe and type-strong world comprising well-written C++ applications, there should be no need for casting and for ...

Get Sams Teach Yourself C++ in One Hour a Day, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.