K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
请判断下列C++代码片段中显式类型转换的使用是否合法安全。
int a = 10; double b = static_cast<double>(a);
const int c = 20; int* d = const_cast<int*>(&c); *d = 30;
class Base {}; class Derived : public Base {}; Base* e = new Base; Derived* f = dynamic_cast<Derived*>(e);
int g = 10; float* h = reinterpret_cast<float*>(&g); cout << *h << endl;