it doesn't work for me.
I have a header file and a cpp file.
I need to define a conversion operator from my class to INT, but it gives me a "syntax error" when declaring it in the H file and implementing it in the cpp file. maybe i got the syntax wrong? in file H, I have "public":
operator int();
and in the cpp file I have:
A::operator int() { return mNumber ;}
If I implement a function in the H file, it works, but I do not want to do this.
can anyone help?
source share