C++ reference deleted function error -
void user::addaccount(const account& _account) { this->account = _account; }
is giving me error, as
void user::adddevice(const device& _device){ this->device = _device; }
does not give error. error is
severity code description project file line suppression state error c2280 'account &account::operator =(const account &)': attempting reference deleted function
i have used same construct , error
you need overload = operator able this.
see, when type x = y in code , if both of same type , compiler(provided not using interpreted language) knows how assign them work fine.
now account custom type, have tell c++ compiler how assign them.
device class/structure have overloaded it. quite simple example same check out
Comments
Post a Comment