Saturday, September 19, 2015

What is operator overloading? Write a program to describe the function overloading.

Solution:-
Operator Overloading:-
      Operator overloading is a polymorphism concept in Oops or C++. Special type of function that allocate additional task for object.
Syntax:- Return type operator symbol ( )
{
      Statement
}
Function overloading:-
      Function that share the same name are said to be overloaded functions and the process is referred to as function overloading. i.e. function overloading is the process of using the same name for two or more functions.

Program function overloading:-
#include< iostream.h >
#include< conio.h >
#include< iomanip.h >
int sum( int x , int y )
{
      int sum = x+y ;
      return sum ;
}
float sum ( float a , float b )
{
      float sum = a+b ;
      return sum ;

}
void main( )
{
      int x=5 , y=6 ;
      cout<<" sum: "<<Sum(x,y)<<endl ;
      float a=5.4 , b=3.3 ;
      cout<< " sum: "<<Sum(a,b)<<endl ;
      getch( );
}


Video Tutorials:-