What is function overloading?,describe it with the example.

Answer Posted / yasir

OverRIDING:
Signature remains the same, the implementing class just writes its own functionality.
int addition(int a, int b)
{
int c;
c = a * b;
return c;
}
changes to
int addition(int a, int b)
{
c = (a + b)*(a-b);
return c;
}
OverLOADING:
Signature changes, but the return type remains the same.

int addition(int a, int b);
changes to
int addition(int a, int b, int prevResult);

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where You Can Use Interface in your Project

1419


Why is polymorphism used?

577


How do you achieve runtime polymorphism?

565


What is abstraction in oop with example?

642


What are the 3 pillars of oop?

607






What is the purpose of polymorphism?

671


What are constructors in oop?

583


Why do we use class?

628


What is encapsulation in simple terms?

535


Write a c++ program to display pass and fail for three student using static member function

2807


Can you inherit a private class?

629


What is destructor in oop?

617


What is polymorphism in oops with example?

525


Plese get me a perfect C++ program for railway/airway reservation with all details.

3423


hi all..i want to know oops concepts clearly can any1 explain??

1677