//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
c*r 发帖数: 278
2
You need copy constuctor for addr_t, since you want to do initialization.