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 |
Write a program to reverse a string using recursive function?
What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 2) 17 3) 16.5
what is abstract class ? when is used in real time ? give a exp
Can anyone please explain runtime polymorphism with a real time example??at what ciscumstances we go for it??
What is the purpose of polymorphism?
What is difference between abstraction and encapsulation?
How to create a comment page in C #??
can we make game by using c
what is the drawback of classical methods in oops?
what is the difference between <stdio.h>and "stdio.h"?
what is overloading
tell about copy constructor