C/C++ ------ 函数参数 为指针或引用时 强制转化 非常危险

 

 

 class CAnimal { public: short int m_hight; short int m_age; }; void GetLen(int &len) { len=0; } int main() { CAnimal an; an.m_age =1; an.m_hight =1; GetLen((int&)an.m_age);//非常危险 return 0; }

 

你可能感兴趣的:(C/C++ ------ 函数参数 为指针或引用时 强制转化 非常危险)