What's wrong with this?# Programming - 葵花宝典
x*g
1 楼
//definition
class addr_t {
public:
addr_t& operator=(const int& inlAddr) {
addr = inlAddr;
return *this;
}
//.....
public:
int addr;
}
//use it
int myaddr= 0x0001;
addr_t temp = myaddr;
//end of the code
the compiler complained " conversion from int to non-scalar type addr_t
requested.."
Anything wrong here? thanx
class addr_t {
public:
addr_t& operator=(const int& inlAddr) {
addr = inlAddr;
return *this;
}
//.....
public:
int addr;
}
//use it
int myaddr= 0x0001;
addr_t temp = myaddr;
//end of the code
the compiler complained " conversion from int to non-scalar type addr_t
requested.."
Anything wrong here? thanx