Functions overloading, C/C++ Programming

Functions Overloading

This a capability in which a C++ program can have several functions performing similar tasks on different data types. When an overloaded function is called, C++ selects the proper function by examining the
number, types and order of the arguments in the call.

Overloaded functions are distinguished by their signatures. A signature is a combination of function's name, and its parameter types.

The compiler encodes each function identifier with the number and types of its parameters to enable type safe linkage. Type safe linkage ensures that the proper overloaded function is called and the arguments conform to the parameters.

Creating overloaded functions with identical parameter list but different return types is a syntax error.


Write a C++ program that uses overloaded functions to find squares of both an integer and double numeric values.

using namespace std;
int square(int);

double square(double);
int square  (int num)

return num*num;



double square  (double num)

return num*num;



int main  ()

int number1;


double number2;


cout<<"Enter an integer number"<


cout<<"Enter a floating point number"<>number2;

cout<<"The square of the integer number is: "

cout<<"The square of the floating number is: "

return  0;

Posted Date: 8/21/2012 11:52:27 AM | Location : United States

Related Discussions:- Functions overloading, Assignment Help, Ask Question on Functions overloading, Get Answer, Expert's Help, Functions overloading Discussions

Write discussion on Functions overloading
Your posts are moderated
Related Questions
You are to implement a code cracking system. The system will deploy four processes (p1,p2,p3 & p4) to try to guess the password of an encrypted code. For encryption, we consider th

find the greater of the two variables, without using conditional loops or ternary operators?

Compiler Design - Limit In The Method Instructions

#padovan string in java   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanStrin

write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

Explain the Loop Statements in Computer Programming? 1. C gives you a choice of three kinds of loop, while, do while and for. 2. The while loop remain repeating an action until

Call by Reference Passing variables(parameters) to a function in C can be done in two ways - pass by value, also called as call by value and pass by address or also known as ca

Project Description: I want a script for an online poker site. It needs to be scanning all the required tables and when the table meets certain criteria it should take a seat at

C Program for FUNCTION  OF COMPOUND INTEREST float ci(float,float,float); void main() {           float p=0,r=0,n=0,k=0;           clrscr();           printf("EN