If I try to compile:
class Outer
{
class Inner
{
int t;
};
public:
Inner inner_;
bool operator ==(Outer rightSide);
};
bool Outer::operator ==(Outer rightSide)
{
if (inner_ == rightSide.inner_)
return true;
return false;
}
I get an error:
/home/martin/Projects/Experimentation/Various-build-desktop/../Various/main.cpp:18:
error: no match for ‘operator==’ in ‘((Outer*)this)->Outer::inner_ ==
rightSide.Outer::inner_’
Please, is it just me doing something wrong or is this a property of C++
EDIT:
Oh, I never realized that the operator == is never synthesized, I was so convinced that it is synthesized, that I did not bother to check.
Thank you Parapura Rajkumar!