Explain operator overloading fundamentals, C/C++ Programming

Assignment Help:

Operator Overloading Fundamentals

The C language uses the concept of Operator Overloading

discreetly. The asterisk (*) is used as multiplication operator as well as indirection (pointer) operator. The ampersand (&) is used as address operator and also as the bitwise logical 'AND' operator. The compiler decides what operation is to be performed by the context in which the operator is used.

Therefore, the C language has been using Operator Overloading internally. Now, C++ has made this facility public. C++ can overload existing operators with some other operations. If the operator is not used in the context as explained by the language, then the overloaded operation, if explained will be carried out.

For example, in the statement

                x = y + z;

If x, y and z are integer variables, then the compiler knows the operation to be performed. But, if they are objects of some class, then the compiler will carry out the instructions, which will be written for that operator in the class.

 


Related Discussions:- Explain operator overloading fundamentals

Give example of the for loop, The for Loop For loop is the controlled f...

The for Loop For loop is the controlled form of loop. The general format of this : for( initialize ; test ; update)                  {                     statements;

When i develop a destructor, When I develop a destructor, do I require to e...

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

C program to demonstrate pointer to string, C program to demonstrate Pointe...

C program to demonstrate Pointer to string: void main() {                 int a;                 char str[]="hello how are you?",*ptr_str;                 ptr_str=&

C, Write a program to find the area under the curve y = f(x) between x = a ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Train Station Schedule, Train Station C++ Program A C++ program that provi...

Train Station C++ Program A C++ program that provides a simple text based interface that will allow a user to create, edit, search, or delete a train schedule. The program will m

Program, write a class player that contains attributes for player name,avg ...

write a class player that contains attributes for player name,avg and team.write three functions to input,change and display these attributes.also write a constructor that asks for

Problem : Change to palindrome, A palindrome is a string that reads the sam...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

C program for merge two strings , v\:* {behavior:url(#default#VML);} o\:* ...

v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0

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