4

Can the == operator be overloaded so as to compare two char[] using a string comparison?

IQAndreas
  • 8,060
  • 8
  • 39
  • 74
ckv
  • 10,539
  • 20
  • 100
  • 144

1 Answers1

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