#include<iostream>
using namespace std;
int main(){
int *p = NULL;
char c1 = (int)p;//C
char c2 = int(p);//c++
return 0;
}
C与C++隐式转换
#include<iostream>
using namespace std;
int main(){
int *p = NULL;
char c1 = (int)p;//C
char c2 = int(p);//c++
void *q = p;
p = q;//error
p = static_cast<int*>(q);
c = static_cast<int>p;//error
return 0;
}
静态类型转换
常类型转换和重解释类型转换不作说明