I'm finishing up an assignment and I've hit a snag on calling an overloaded operator in a class.
Here's the generals,
-4 employee child classes created from a virtual "Employee Class"
-objects created dynamically and stored in a base pointer array
-each child class has an overloaded operator == in order to do a search by last name w/o using a get function.
The code for the overloaded operator looks like this:
-----------------------------------------------------
bool operator == (string lName)
{ bool result=false;
if (empLastName == lName)
result = true;
else
result=false;
return result;
}
-----------------------------------------------------
The compile error happens at the call:
-----------------------------------------------------
do
{
if (*employee[j] == findLastName)
{
found = true;
foundCount = j;
};
j++;
}while ((!found)&& j<empCount);
----------------------------------------------------
The error is funky:
error C2784: 'bool std:
perator ==(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Ax> &' from 'Employee'
----------------------------------------------------
Anyway, any ideas would be greatly appreciated