I have two files:
my_header.h
:
class my_class {
public:
my_class();
my_class(long long number);
my_class(int number);
my_class(double number);
bool operator<(const my_class& rhs) const;
//////
}
my_class.h
:
my_class::my_class()
{
//implementation
}
my_class::my_class(long long number)
{
//implementation
}
my_class::my_class(int number)
{
//implementation
}
my_class::my_class(double number)
{
//implementation
}
bool my_class::operator<(my_class const& rhs) const
{
//implementation
}
I do not understand, where I do mistake. I overload operator <
. Also, I have constructor
from double
type.
Of course, Also, I implement other 5 operators (==, !=, >, <=, =>
) by this scheme. Other operators are in the same namespace, but they are not member function.
Test case is:
my_class a = 2;
bool check = 5.17 < long_int1;