What is difference between function overloading and overriding?



What is difference between function overloading and overriding?..

Answer / niraj verma

It is possible in C++ to use the save function name for the
no of lines for different intention. Defining multiple
function with same name is know as function overloading or
function polymorphism.

Polymorphism means one function having many forms.
The overloading function must be different in its argument
list and with different data types.

Example:
#include<iostream.h>
#include<conio.h>
int square (int);
float square (float);
void main()
{
int a = 5;
float b = 2.5;
clrscr();
cout<<"square = "<<square(a);
cout<<"\n square = "<<square(b);
getch();
}
int square(int s)
{
return (s*s);
}
float square (float j)
{
return (j*j);
}

Overloading;

Is This Answer Correct ?    9 Yes 1 No

Post New Answer

More OOPS Interview Questions

Why do we use oop?

0 Answers  


What is polymorphism explain its types?

0 Answers  


what is a virtual class?

5 Answers   Cap Gemini, IBM, Infosys, Trinity Technologies,


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

0 Answers  


sir plz send me a set of questions that been frequently held in written examination during campus selection.

0 Answers   TCS,






How to hide the base class functionality in Inheritance?

0 Answers   Viscus Infotech,


what is the difference between ERROR and EXCEPTION?

14 Answers   NIIT, nvidia,


function overridind means and simple program

2 Answers  


what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks.

2 Answers   Excel,


what is Class in oops with example?

4 Answers   HCL,


Whats oop mean?

0 Answers  


What is abstraction in oop with example?

0 Answers  


Categories