CodeMonkey, you are right, but ^ can be overloaded.
Leo, how do you know there is something wrong with your code?
Did it not compile? Or it didn't give a correct output?
I noticed you didn't give any cout or printf statements in your code. You didn't even store the result in a variable. Is this your real code?
Also, your main() doesn't return any value.
If you are using cout to display your answer, use cout<<(ol^7); ---1
instead of cout<<ol^7; ---2
as << has more priority than ^ and your compiler will read the 2nd statement as (cout<<ol)^7
CodeMonkey, you are right, but ^ can be overloaded.
I know that the operator can be overloaded, I would say that the semantics of the operator should not be changed ie you should not be trying to make the xor operator into a power operator.
CodeMonkey forgot to put const on line 23 int getVarI() const {return varI;}, line 24 float getVarF() const {return varF;} and line 32 ostream& operator<<(ostream&out,const objA &o).
Thanks ,now everithing works
Could you explain why ,in this case all this functions has to me constant
If I use operator overload<< in diferent case to print object works fine without const