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 |
Why do we use oop?
What is polymorphism explain its types?
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
sir plz send me a set of questions that been frequently held in written examination during campus selection.
How to hide the base class functionality in Inheritance?
what is the difference between ERROR and EXCEPTION?
function overridind means and simple program
what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks.
what is Class in oops with example?
Whats oop mean?
What is abstraction in oop with example?