This:
const CResultats & operator = (const CResultats & desResultats);
Is a declaration of a function which takes a CResultats
by const-reference, and returns a CRFesultats
by const-reference. The method itself is not const
.
But this:
CResultats CResultats :: operator = (const CResultats & desResultats) const
Is a function definition for a const
function which takes a CResultats
by const-reference, and returns a CResultats
by-value.
Those are two different things in two ways:
- You declare the function to return by const-reference, but you define it it return by value.
- You declare the function to be non-const, but you define it to be const.
If you want to definition to match the declaration, then you must change the definition to:
const CResultats & CResultats::operator = (const CResultats & desResultats)
{
// ...
}