1

For me they look very similar. If you can direct somewhere where I can read about it I would appreciate it. Thanks!

operator int() const
  {   
    return value;
  }

  int operator()() const
  {
    return value;
  }
exer240
  • 27
  • 4
  • 5
    `operator int() const` is not an overload of `operator()`. It is the conversion operator `operator int` used when your type is being converted to `int`. – François Andrieux Jun 08 '21 at 14:29
  • 1
    Possible duplicate of [How do conversion operators work in C++?](https://stackoverflow.com/questions/1307876/how-do-conversion-operators-work-in-c). – François Andrieux Jun 08 '21 at 14:30
  • 1
    The name of the first function is "operator int", without a return type; it's a conversion function. The name of the second function is "operator()", with a return type of `int`, and it's the function-call "operator". – molbdnilo Jun 08 '21 at 14:34
  • [User-defined conversion operator](https://en.cppreference.com/w/cpp/language/cast_operator) and [functional call operator](https://en.cppreference.com/w/cpp/language/operator_other). – Eljay Jun 08 '21 at 15:00

0 Answers0