Join Peggy Fisher for an in-depth discussion in this video Understanding implicit and explicit conversion, part of Up and Running with C++.
- View Offline
- Exercise Files
…Although it's important to declare to each variable with a specific data type,…this value can be changed both temporarily…or permanently using implicit and explicit conversion.…An implicit conversion occurs when an equation has mixed data types.…For example when you add an integer…variable and a short variable, the program automatically…chooses the larger of the two and in this case would create an integer variable.…When you multiply an integer times a double, a double is a…larger data type it will automatically create a variable of type double.…
Same thing with float and double.…Float divided by double will still create a…double since double is larger than a float.…When you assign a character variable to an integer value, it…does an implicit conversion and converts the integer over to the character.…We saw that in our ASCII table program.…An explicit conversion allows a programmer to have control…over the variable data types by using a static_cast command.…For example, if you wanted to change the…value of a variable, you can use static_cast.…
- Downloading and exploring the C++ IDE
- Working with loops
- Using predefined functions
- Creating custom functions
- Creating and instantiating classes
- Working with external files
Skill Level Beginner
1. Getting Started
2. C++ Basics
3. Flow of Control
4. Classes and Objects
5. Data Structures
6. File Manipulation
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.