zettelkasten
Type Conversions
Last updated: 1/9/2025
Type conversions is turning one thing into another, there are some automatic conversions that happen which are called implicit conversions and they happen when you do an operation on two objects and they are not the same type. The object that is more narrow gets converted into a wider obj (ex. int will turn into double when the following expression instead of the double turning into an int because the double "contains" all integers):
c++
2.5 * 5There are also explicit conversions that are done with:
c++
static_cast<type>(object);These conversions are "safe" when data is not lost.
See Also
- [[computer-science]]