Can the ==
operator be overloaded so as to compare two char[]
using a string comparison?
Asked
Active
Viewed 1,499 times
1 Answers
9
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
- 348,265
- 75
- 913
- 977
-
2...only be overloaded where at least one parameter is of class type, I would have said. – Jun 06 '10 at 19:13
-
1
-
1@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 Jun 06 '10 at 19:15