What is operator overloading? Give Example
Answers were Sorted based on User's Feedback
Answer / palsaniya sadikhasan, meta.
Operator overloading is an operator that perform different
task based on given arguments.
e.g. suppose '+' is an operator is used to add two number
and if we use '+' with two strings then operator '+' can
concate two string is known as operator overloading.
or
operator overloading means one operator can perform multiple
operation based on given arguments.
Is This Answer Correct ? | 39 Yes | 2 No |
Answer / riya piyush jain
Operator overloading (less commonly known as operator ad-
hoc polymorphism) is a specific case of polymorphism in
which some or all of operators like +, =, or == have
different implementations depending on the types of their
arguments. Sometimes the overloadings are defined by the
language; sometimes the programmer can implement support
for new types.
Is This Answer Correct ? | 23 Yes | 1 No |
Answer / sagar kelkar
it may be defined as an operator performing different
operations.for ex-arithmetic operators such
as(+,-,*,/,++,--) etc..
Is This Answer Correct ? | 22 Yes | 8 No |
Answer / msn
Making an operator doing different operation other than
the normal one is termed as operator overloading..
Say for example Operator + is normally used to add numbers
but we can add another function concatenate two strings
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / selva
operator performing different task based on argument supplied.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / karthik
A single operator is used to perform diff fuction in a
program is known as operator overloading..
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / xxxx
A single operator is used to perform diff fuction in a
program is known as operator overloading..
Operator overloading is an operator that perform different
task based on given arguments.
e.g. suppose '+' is an operator is used to add two number
and if we use '+' with two strings then operator '+' can
concate two string is known as operator overloading.
or
operator overloading means one operator can perform multiple
operation based on given arguments.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / mohd nadeem
operator overloading provides special meaning to predefined operators with respect to user defined data types like class, struct, enum.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / karthika
usually operators dealing with basic data types,operator
overloading allows the users to give additional meaning to
most operators so that it can be used with user's own data
types.
Is This Answer Correct ? | 0 Yes | 0 No |
difference between abstraction and encapsulation with progarammatic eg. hi,just recently i went for an interview .The interviewer asked what is the difference between abstraction and encapsulation with programmatic eg. I gave the answer as encapsulation mean hiding the relevant data which is not useful for the user, eg a electric fan .hiding the information how the electricity is converted into machanical energy. abtraction showing only the relevant data to the user eg electric fan. it look ,its color ,it design etc only relevant data. Then the interviewer asked me, give me some programmic eg .I Said Let assume a web form having control like textbox,button etc. The user can view textbox,button etc this is the eg of abstraction and when the user click on the button how he is redirected is not known by the user is the eg of the encapsulation. Am I Correct .was the answer given by me is perfect .now i am planing to go for an another interview should i give the same answer.IF not please suggest me a better answer.with some good eg Please help
1.what are two type of classe members called? 2.what is data hiding and data encapsulation? 3.how do you make a class member visible aouside its class? 4.what is the default visibility of a class data member? 5.what are the advantages of oop over the structured programing?
Why many objects can working together? How objects working togetherM I want to see example code.
features of OOPS
22 Answers Ness Technologies, Satyam,
What is the difference between static polymorphism and dynamic polymorphism?
who is the founder of c++?
what is data hiding.
write string class as your own class in java without using any built-in function
Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.....
4 Answers Bally Technologies, IBM, SoftSol,
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
What is destructor oops?
Why we use classes in oop?