static_cast
时间: 2023-10-18 08:26:18 浏览: 41
static_cast is a type of casting operator in the C++ programming language. It is used to perform explicit conversions between compatible types, such as converting between primitive types or converting a pointer to a base class into a pointer to a derived class.
For example, you can use static_cast to convert an integer to a floating-point number:
```
int num = 10;
double result = static_cast<double>(num);
```
In this case, the static_cast is used to convert the integer variable `num` into a double type, and the result is stored in the `result` variable.
Please let me know if you have any more questions!