How can I make pure virtual function a operator+(); function. wheh ı do like this in base class int operator+()=0; compiler gives error . in derive class operator+() funct
The syntax for a pure virtual function would be something like:
class X {
public:
virtual int operator+(X const &rhs) = 0;
};
Note, however, that you only rarely want to do this -- you typically want an overload of operator+ to be implemented as a free function, to allow conversion of the left operand (if necessary).