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 do you mean by Encapsulation?
write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.
#include <iostream> using namespace std; int main() { int a = 3; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][2]; }
What is conditional Compilation?
WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP
What does and I oop and sksksk mean?
What do you mean by binding of data and functions?
what is difference between String s=new String("vali"); String s="vali"
What are the advantages of inheritance?
26 Answers IBS, TCS,
What does <> mean pseudocode?
What is encapsulation with example?
function overridind means and simple program