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 |
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is the Advantage of Interface over the Inheritance in OOPS?
Why is abstraction used?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
How do you answer polymorphism?
What is the difference between const int *ptr and int const *ptr???
wht is ditch
143.what is oops principles?
When will a constructor executed?
How is data security provided in Object Oriented languages? ?
which are the 4 members functions in c++ objects that can either be declared explicitly by programmer or implementation if nt available.
What is polymorphism explain its types?