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
Define some features of static storage class in c program? The features of a variable defined to contain a static storage class are as follows. Storage - memory Default

why is programming is needed now-a-days.what is the benefit of colleges to apply heavy loads on students head.


Want an EA project for Jack Bsher Project Description: New EA game Skills required   Android, C++ Programming, PHP, Metatrader, SQL


Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Operation on list - c++ program: Write a program in c to Insert value on list and list iteration. typedef struct item *node_ptr; struct item {                   int e

Binary Options EA for DirectFX and SignalPush Project Description: I want a programmer who will build an EA based on my three types of Binary strategy's using two Indicators.

WAP TO PRINT THE LARGEST NUMBER FROM ANY 10 NUMBERS #include stdio.h> #include conio.h>   void main()   {                    int a[10],i,max;

Part 1 Assignment:  develop a calculator in MASM. Text chapters covered:  1 through 4, 5.4, 5.5, 6.3, 7.4 You will develop a "calculator" algorithm in MASM using reverse-