ckv
ckv

Reputation: 10830

Overloading the == operator to compare two char[] using a string comparison

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

Upvotes: 4

Views: 1512

Answers (1)

James McNellis
James McNellis

Reputation: 355187

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.

Upvotes: 9

Related Questions