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 |
what is inline function?
What is R T T I ?
what is virtual function?
26 Answers Aspire, HP, Infosys, RoboSoft, TCS,
Is html an oop?
what are the ways in which a constructors can be called?
What is difference between class and object with example?
1.what are two type of classe members called? 2.what is data hiding and data encapsulation? 3.how do you make a class member visible aouside its class? 4.what is the default visibility of a class data member? 5.what are the advantages of oop over the structured programing?
Why is polymorphism important in oop?
what is the technical or oop name of object?
What is an interface in oop?
what is difference between class template and template class?
What is class and object with example?