q can i overload operator so it allow me compare


Q: Can I overload operator == so it allow me compare two char[] by a string comparison?

A: No: at least one operand of particular overloaded operator should be of some user-defined type (most of the time it means a class).

However even if C++ let you to do this, which it doesn't, you wouldn't wished to do it anyway as you really should be using a std::string-like class instead of an array of char in the first place since arrays are evil.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: q can i overload operator so it allow me compare
Reference No:- TGS0217723

Expected delivery within 24 Hours