Can i overload operator == so it allow me compare two char[], C/C++ Programming

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.

 

Posted Date: 3/20/2013 3:46:26 AM | Location : United States







Related Discussions:- Can i overload operator == so it allow me compare two char[], Assignment Help, Ask Question on Can i overload operator == so it allow me compare two char[], Get Answer, Expert's Help, Can i overload operator == so it allow me compare two char[] Discussions

Write discussion on Can i overload operator == so it allow me compare two char[]
Your posts are moderated
Related Questions
drawbacks in assignments in engeenirng

HWID Spoofer for Windows 7, 8 x64 Project Description: I want a simple program that will spoof my hardware id. I should be able to prepare the id to spoof to in the program a

Question 1 . Write a brief note on Aggregation Question 2 . Discuss briefly on constructors Question 3 . What are the important advantages of Inheritance? Question 4 .

how to program?

Can I free() pointers allocated  along with new? Can I delete pointers allocated along with malloc()? A: No. It is completely legal, moral, and wholesome to employ malloc() a


The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th

Define the Arithmetic Operators in c Language? There are five arithmetic operators in C and they are Operator             Purpose +                        Addition -


¦It should ask customers to enter details such as their names and addresses. ¦It should print a welcome message that includes the customer’s name. ¦It should provide a list of avai