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[]

Compiler design-limit the methods, Problem : Compiler Design - Limit the me...

Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: ·

C programs, accept principal amount,rate of interest, & duration from the u...

accept principal amount,rate of interest, & duration from the user. display interest amount and total amount

Program of conversion between objects of different classes, Conversion betw...

Conversion between Objects of Different Classes As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a functio

Program of 2d byte array dynamicall, In this lab, please complete a given p...

In this lab, please complete a given program to perform the following tasks: 1. Allocate a 10 by 5 2D byte array dynamically. The way of allocation must be consistent with page

Write a haskell program, Write a Haskell program that calculates a balanced...

Write a Haskell program that calculates a balanced partition of N items where each item has a value between 0 and K such that the difference between the sum of the values of first

Destructor , How can I handle a destructor that fails? Need help please pro...

How can I handle a destructor that fails? Need help please provide example also.

Pebble merchant, simple coding for pebble merchant..

simple coding for pebble merchant..

Graphical user interface designed for the output peripherals, Introduction ...

Introduction to I/O interfacing, discuss microcontrollers applications in industry. Detailed product design specifications that have sections on both hardware and software inclu

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