Answer the question
In order to leave comments, you need to log in
What difference does it make where the const is?
What is the difference between the 2nd entries below?
In the first, the return value becomes constant, and in the second?
1) const float MyClass::operator float()
2) float MyClass::operator float() const
Answer the question
In order to leave comments, you need to log in
The second tells the compiler that the call does not change the state of the object. Such methods can be called on const MyClass&.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question