#include <iostream>
struct trade_record {
trade_record(){};
trade_record(int code) :code(code) {};
int code;
};
int main()
{
int code = 50;
trade_record(); //1.编译正常通过
trade_record(50); //2.编译正常通过
trade_record(code); //3.编译报错: error C2371: 'code': redefinition; different basic types
trade_record obj = trade_record(code); //4.编译正常通过
}
请问一下 第三种构造方式为什么会报错 'code': redefinition; different basic types.非常迷惑,请大神解释一下。谢谢!
--
FROM 118.113.96.*