This code helps to understand the concept of function overloading using C++. Two different data types are taken in the code.
Function Overloading is basically used to make multiple functions of a similar name that execute similar tasks, but with different data types. In this code, the data types taken are int and double. Both the data types are performing the same task using overloaded functions. In the first calculate function it calls the integer version while in the second calculate function it calls the double version. The compiler identifies the type/number of arguments to which function is being called.
Submitted by Pratyasha Sahu (pratyashasahu)
Download packets of source code on Coders Packet