I have this code sample:
class Number
{
int i;
public:
Number(int i1): i(i1) {}
operator int() const {return i;}
};
What are the implications of removing the const modifier from the casting operator?
Does it affect auto casting, and why?
If the conversion operator is not const, you can’t convert const objects: