I've got a function that returns the object that is being checked. It is giving me an error telling me that I do not have a copy constructor. I do have two constructors. I'm not sure why I'm getting this error. I've got to get this done today. I'd appreciate any help.
StateData StateData::getStateData(string n, bool &found)
{
if (name == n)
{
found = true;
returnthis; //here is where I get the error
}
}
Constructors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
StateData::StateData()
{
name = " ";
capitol = " ";
yearAdmit = 0;
order = 0;
}
StateData::StateData(string n, string c, int y, int o)
{
name = n;
capitol = c;
yearAdmit = y;
order = o;
}
Line StateData temp = HTable[hashIndex]; copies object in HTable[hashIndex];
However you didn't declare copy constructor for StateData class.
Its signature: StateData::StateData(const StateData& from)
Without it compliler does not know, how to construct your object.