Operator keyword - please interpret this line

63 Views Asked by At
operator const double() const { return mdValue; }

To add, mdValue is a double.

I really don't get this line. I know the operator keyword is used to overload operators, but I've not yet encountered a sample like the line above, so I'm confused as to what is being overloaded on that line of code.

1

There are 1 best solutions below

1
On BEST ANSWER

This is a conversion/cast operator.

See http://en.cppreference.com/w/cpp/language/cast_operator