Author Topic: Navigate to an Overloaded Operator  (Read 5240 times)

Lisa

  • Senior Community Member
  • Posts: 238
  • Hero Points: 24
  • User-friendly geek-speak translator extraordinaire
Navigate to an Overloaded Operator
« on: April 22, 2008, 01:50:52 pm »
Did you know that you can use Ctrl+Dot to navigate to an overloaded operator in C++? Go to the line containing "toDo == toEat" and put your cursor on "==", then press Ctrl+Dot.

Code: [Select]
class Something {
    //...
public:
    bool operator == (const Something &rhs);
    bool operator != (const Something &rhs);
    //...
};

bool Something::operator ==(const Something &rhs) {
   return true;
}
bool Something::operator !=(const Something &rhs) {
   return !this->operator ==(rhs);
}

void main(int argc, char argv[])
{
   Something toDo;
Something toEat;
   //...

   if ( toDo == toEat ) {
       printf("It's time for lunch.\n");
   }
   //...
   
}

raj2all

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Navigate to an Overloaded Operator
« Reply #1 on: May 06, 2008, 07:46:27 am »
that's good feature I was not aware of.

But it seems like this feature is not working for Function call operator ( () )

Regards