6

I have a class Samp. In Samp.cpp, I can define/declare a function like

 Samp& operator+(Samp& other) {
  std::cout << "something";
  return other;
}

What is this function exactly? How do I call it?

Daniel Frey
  • 55,810
  • 13
  • 122
  • 180
shreyasva
  • 13,126
  • 25
  • 78
  • 101

1 Answers1

11

This is actually a unary +, you call it like this:

Samp s;
+s; // <-- here
Daniel Frey
  • 55,810
  • 13
  • 122
  • 180