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
  • 52,317
  • 11
  • 110
  • 168
shreyasva
  • 11,896
  • 23
  • 73
  • 101

1 Answers1

11

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

Samp s;
+s; // <-- here
Daniel Frey
  • 52,317
  • 11
  • 110
  • 168