What is function overloading and operator overloading?

Answer Posted / jerry

function overloading - function name will be same but
operation will be different for eg:

if we take the function as area
then 1. area(int x,int y)
2. area(int x);
these r the two functions with the same name but
they will differ by their arguments given
for the 1st function
it becomes the area of the rectangle=x*y
for the 2nd function it becomes the area of square=x*x


coming to the operator overloading,
it is an overloading function of an operator.
if we + as an operator
a+b then + is operator for the operands a,b
c+d then + is also an poperator for the c,b.
these r the two properties of polymorphism.

Is This Answer Correct ?    53 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you achieve runtime polymorphism?

569


What is class and object with example?

585


What is overloading in oops?

598


What is and I oop mean?

618


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

1458






Give two or more real cenario of virtual function and vertual object

1851


How to hide the base class functionality in Inheritance?

638


What are two types of polymorphism?

611


Are polymorphisms mutations?

702


how to get the oracle certification? send me the answer

1670


What is new keyword in oops?

591


write string class as your own class in java without using any built-in function

1976


What are the 5 oop principles?

601


What is the use of oops?

619


What is encapsulation example?

547