[C++] Can all/any struct assignment operator be Overloaded? (and specifically struct tm = sql::Resu
- by Luke Mcneice
Hi all,
Generally, i was wondering if there was any exceptions of types that cant have thier assignment operator overloaded.
Specifically, I'm wanting to overload the assignment operator of a tm struct, (time.h) so i can assign a sql::ResultSet to it.
I have already have the conversion logic:
sscanf(sqlresult->getString("StoredAt").c_str(),"%d-%d-%d %d:%d:%d",&TempTimeStruct->tm_year,&TempTimeStruct->tm_mon,&TempTimeStruct->tm_mday,&TempTimeStruct->tm_hour,&TempTimeStruct->tm_min,&TempTimeStruct->tm_sec); //populating the struct
I tried the overload with this:
tm& tm::operator=(sql::ResultSet & results)
{
//CODE
return *this;
}
however VS08 reports:
error C2511: 'tm &tm::operator
=(sql::ResultSet &)' : overloaded member function not found in 'tm'