What is operator overloading? Give Example

Answers were Sorted based on User's Feedback



What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

Answer / selva

operator performing different task based on argument supplied.

Is This Answer Correct ?    4 Yes 0 No

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

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

What is operator overloading? Give Example..

Answer / kalai391989

operator overloading is a function..

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More OOPS Interview Questions

Which is the only operator in C++ which can be overloaded but NOT inherited?

8 Answers  


What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 2) 17 3) 16.5

16 Answers   TCS,


polymorphism means?

6 Answers   BFL,


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

0 Answers   Microsoft, TCS,


What is overloading in oops?

0 Answers  






Why a "operator=(...)" when there is a copy ctor?

2 Answers  


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

0 Answers   TCS,


Write a C++ program to conduct an election of a mayor.Declare a class ELECTION With the following specification: Data member: Name 25 character Age Integer symbol 1 character Member functions: To accept data for 20 contestant To accept symbol as voting from 100 voters. To declare the winner and the loser.

1 Answers   Global Academy, Infotech,


what is an instance of a class

5 Answers  


explain the concepts of oops?

1 Answers  


Why many objects can working together? How objects working togetherM I want to see example code.

2 Answers  


What are the fields of vtable

1 Answers   Mphasis,


Categories