Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

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

like image 760
ckv Avatar asked Jan 21 '23 23:01

ckv


1 Answers

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.

like image 181
James McNellis Avatar answered Feb 11 '23 15:02

James McNellis