C++ examples for Function:Function Overload
Overloaded square Functions
#include <iostream> int square(int x) { std::cout << "square of integer " << x << " is "; return x * x; } double square(double y) { std::cout << "square of double " << y << " is "; return y * y; } int main(int argc, const char *argv[]) { std::cout << square(7);/* w w w . j a v a 2s.c o m*/ std::cout << std::endl; std::cout << square(7.5); std::cout << std::endl; return 0; }