tags:

views:

176

answers:

1

Can operator == be overloaded so as to compare 2 char[] using a string comparison.

+6  A: 

No; at least one parameter of an operator overload must be of class or enumeration type.

char[] and char* are array and pointer types, which are not class or enumeration types.

James McNellis
...only be overloaded where at least one parameter is of class type, I would have said.
anon
... and in addition enumeration types.
Johannes Schaub - litb
@Neil: That would certainly be clearer and more correct. Fixed and thanks. @Johannes: That too. *sigh* well, this answer started off pretty poorly. :(
James McNellis
@James: All is well that ends well.
sbi