我有以下使用 Visual Studio 2008 编译的 C/C++ 代码:
struct TEST_STRUCT{
int nV;
float v;
TEST_STRUCT()
{
nV = 0;
v = 0.0;
}
};
TEST_STRUCT v1;
v1.nV = 100;
v1.v = 2.0;
const TEST_STRUCT v2; //Making it 'const' to prevent any further changes
(TEST_STRUCT)v2 = v1;
int a = v2.nV; //'a' is 0, why???
为什么我会得到如此奇怪的结果?