D
devphylosoff
I can write
friend bool operator<(const Integer& left, const Integer& right);
but i cannot use
virtual bool operator<(const Integer& left, const Integer& right);
or
bool operator<(const Integer& left, const Integer& right);
no.cpp:10: error: bool Integer:perator<(const Integer&, const
Integer&) must take exactly one argument
1. why this error does not occur while use "friend" prefix?
2. and how to create "virtual bool operator<" ?
in code :
---------------------------------------------------------------
#include <iostream>
using namespace std;
class Integer{
friend bool
operator<(const Integer& left,
const Integer& right);
virtual bool
operator>(const Integer& left,
const Integer& right);
};
main(){}
friend bool operator<(const Integer& left, const Integer& right);
but i cannot use
virtual bool operator<(const Integer& left, const Integer& right);
or
bool operator<(const Integer& left, const Integer& right);
no.cpp:10: error: bool Integer:perator<(const Integer&, const
Integer&) must take exactly one argument
1. why this error does not occur while use "friend" prefix?
2. and how to create "virtual bool operator<" ?
in code :
---------------------------------------------------------------
#include <iostream>
using namespace std;
class Integer{
friend bool
operator<(const Integer& left,
const Integer& right);
virtual bool
operator>(const Integer& left,
const Integer& right);
};
main(){}