Today’s Dev Corner post is brought to you by AJ Orians.
The cast operator is not well known so I’ll explain what it is and how it can be used. To start off POD stands for Plain Old Data in C++ which is things like int, char, double, etc. Unfortunately you cannot inherit off of such datatypes. One advantage of inheriting is you can cast to the base type (assuming public inheritance). With the cast operator you’ll be able to specify types that your object can cast to. Below is a simple example showing how the cast operator works:
As you can see I am able to cast the object of type A to an int type.
Do you now understand the cast operator? Do you see yourself having a use for it? Let me know what you think!
Andrew “A.J.” Orians is a developer on the Windows version of Camtasia Studio. Though he enjoys programming he also likes puzzles, running, games, and a whole slew of other activities. He has been at TechSmith for something like five years and looks forward to being here for many more!
The post Dev Corner – Cast Operator appeared first on TechSmith Blogs.