Please post your actual code here. The following compiles fine for me:
class Triangle
{
int _length;
int _begin_pos;
public:
Triangle(int len = 0, int pos = 0):_length(len), _begin_pos(pos){}
inline bool operator==(const Triangle& rhs) const ;
};
inline bool Triangle::operator==(const Triangle& rhs) const
{
return _length == rhs._length && _begin_pos == rhs._begin_pos;
}
int _tmain(int argc, _TCHAR* argv[])
{
Triangle t4(1, 2); // initialize _length as 1 and _begin_pos as 2
Triangle t5(1, 2);
if (t4 == t5)
std::cout << "equal " << std::endl;
else
std::cout << "not equal " << std::endl;
return 0;
}
