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

Assignment Help:

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.

 


Related Discussions:- Can i overload operator == so it allow me compare two char[]

C program to swap the two values, Program is to swap the two values which a...

Program is to swap the two values which are enter by user: Program is to swap the two values which are enter by user through the function with values changed using pointers

Program for single int parameter, Write a function that has a single int pa...

Write a function that has a single int parameter n and returns an int: 0 if n is negative, otherwise 1. You are not allowed to simply check the integer value, and should use the fu

Described assignment operator?, Default assignment operator mange assigning...

Default assignment operator mange assigning one object to another object of the same class. It is member to member copy as shallow copy.

Source code on home stay, I am doing project on home stay which includes fe...

I am doing project on home stay which includes features like add homestay,search,book,delete homestay,

Tree, Write algorithm and program for the conversion of a Tree to a Binary ...

Write algorithm and program for the conversion of a Tree to a Binary Tree

Overloading unary operators, Overloading Unary Operators class sign ...

Overloading Unary Operators class sign {int a,b,c; public: sign(){}; sign(int,int,int); void putdata(void); void operator-(); }; void sign::operator-() {a=

Displays the lower case and upper case alphabetical letters, Write a progra...

Write a program that displays both the lower case and upper case alphabetical letters using the following Format Lowercase        Uppercase a                        A

Source code for decoe to code, i am using mobile phone if i want to communi...

i am using mobile phone if i want to communicate via massage but that should be very secret

Write a program that computes the cost of a long distance ca, Write a progr...

Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules. a. A call made between 8:00 AM and 6:

C program for find even & odd no.s in the array , C Program for FIND EVEN &...

C Program for FIND EVEN & ODD NO.S IN THE ARRAY #include stdio.h> #include string.h> #include conio.h> void main() {           int i=0,j=0, l_e[100],l_o[100];

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd