The following rules are
applicable for implementing function overloading concept.
1) Function
name should not be a keyword. Meaningful name should be given to function names
and variables.
1)
C++ allows more than one function with the same
name with signature. This concept is called “function overloading”.
Signature means either the
number of parameters or data types of parameters or order of parameters should
be different. Return type should not be considered as a signature.
C++ compiler is strict checking
type. If we pass integer variables as arguments then calling function goes to 1st
block in above program.
This concept is called function
overloading. In-spite of we are passing so many arguments instead of required
arguments, only 1st few arguments will be taken into
consideration.
Compile time error.
While implementing default arguments, we should not overload
the function with leftover arguments.
Here the default argument is r=5. If we pass two arguments
then the compiler gets confused to select particular function.
Here this is valid. Instead of using function overloading
concept, by making additional arguments as zero, we can get better results for
same function.