Using operator() in member functions
c++, operator-overloading
Solution
You should write:
void A::operator()(double x) {
// stuff with other members and x
this->operator()();
};
The first `()` are the name of the operator, and the second are for the call itself: that's the missing (empty) argument list from the error message.
Problem
I overloaded the operator () in one of my classes and I would like to use it in another member function. ``` class A { public: void operator()(); void operator()(double x); }; void A::operator()() { // stuff }; void A::operator()(double x) { // stuff with other members and x this->operator(); }; ``` The line `this->operator()` does not work. I just want to use the operator I defined as a member function of my class `A`. The error I get is : `Error 1 error C3867: 'A::operator ()': function call missing argument list; use '&A::operator ()' to create a pointer to member`