Function overloading

// Function Overloading.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream"
using namespace std;
int area(int side)
{
       return side * side;
}
int area(int l, int b)
{
       return l * b;
}
void main ()
{
       int(*p1)(int);
       int(*p2)(int, int);
       p1 = area;
       p2 = area;
       cout << "Adress of are(int) = " << (unsigned int)p1 << cout <<
             "Adress of area(int, int) = " << (unsigned int)p2 << cout<<
             "Invoking area(int) via p1" << cout << "Invoking area(int, int) via p2";
       system("pause");
}






Share on Google Plus