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 |
WAP to generate 2n+1 lines of the following pattern on the computer screen:
How to overload new operator in c++
what is an qt4 interface?
Why is oop better than procedural?
swapping program does not use third variable
How do you make derived class as an abstract class?
what is the difference between a package and a software?
What is overriding in oops?
Generally, in all C++ programs, texts are in white colour. Can we change the colour of the text(either input or output or both)? If so, help me out.
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
What is encapsulation c#?
to find out the minimum of two integer number of two different classes using friend function