why to use operator overloading
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / rekha
Operator overloading means giving additional meaning to
existing operators
Operators are defined to perform some operation on
fundamental types .Operator cannot work with user defined
types like classes and struct.so concept of operator
overloading means allows defining the meaning of operator so
that the can be used for performing operations on user defined
types.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / r.ramakrishna
BY using the operator overloading we can the more than one
operator in single function.
Is This Answer Correct ? | 4 Yes | 4 No |
What is object-oriented programming? Webopedia definition
what is single inheritance?
what are the disadvantages of C++?
25 Answers ATS, Infosys, UNI, Wipro,
i got a backdoor offer in process global,Bangalore..Can i work with it?
what is Class in oops with example?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
How does polymorphism work?
What does and I oop mean in text?
What are the benefits of oop?
What is the oops and benefits of oops programming?
Definition of Object Oriented Programming in single line?
33 Answers Impact Systems, Q3 Technologies, TCS,
Prepare me a program for the animation of train