Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

why to use operator overloading

Answer Posted / chandra

to achieve synchronization with the normal languages like c.
for example int a=10,b=30,c;
c = a+b ;
the above operation is possible in c as well as c++.bcos
the variables declared are primitive types.

If u want to do same thing for user defined datatypes, i
can say objects, we have to overload the operators.

For ex:
Assume that u created one class
Class A
and u have created objects
A obj1(10),obj2(30),obj3;

and u want the add 2 objects and result must be stored in
another object.

then u have to overload the operator + for class A.

obj3 = obj1 + obj2 ;

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are properties in oop?

1080


What is oops concept with example?

1011


c++ program to swap the objects of two different classes

2410


What is the difference between abstraction and polymorphism?

1091


What is meant by multiple inheritance?

1241


What is the real life example of polymorphism?

1164


Why is abstraction needed?

1032


What does I oop mean?

1068


Which type does string inherit from?

1100


Why is static class not inherited?

1101


Why is oop better than procedural?

1071


any one please tell me the purpose of operator overloading

2395


what are the different types of qualifier in java?

2269


What is oops?what is its use in software engineering?

1026


What is polymorphism give a real life example?

1031