what is function overloading..?
Answers were Sorted based on User's Feedback
Answer / pankaj kumar sharma
Function overloading takes place when a function is
overloaded with two or more tasks ie. same function is
having different behaviour.
It takes place when two functions have same name but
differs in argument list ie. may be the no of arg in both
fun are different or type of the arguments in argument list
are diff.
As return type of a func. does not take part in name
mangling so return type for overloaded functions may differ
or not.
eg: int fun(int arg1, int arg2)
char* fun(char* ptr1)
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / rabih
two functions with same but different signature
example let take function name test return int and take a
parameter of type int (int test(int x))
let take same function of name test with different
signature void test(int x) or int test(bool n) or
int test(int x,string y)
all these functions can written in same class without any
error this means same function name(test)
different signature is deffernet return type or different
paraemeter type
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / achal ubbott
Here i tell how function overloading works. The point is
name mangling. Each c++ compiler follows an algorithm
called Name Mangling algorithm. Its job is to create
different symbols for functions. The mangled name of the
function would depend upon number,type and order of
function arguments. You can see these mangled names in the
assembly code. But C does not mangle function Names.
Unfortunately there is no ISO standard for name mangling.
So most c++ compilers do that in a different way
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / anjana
FUNCTION OVER LOADING:
TWO OR MORE FUNCTIONS HAVING THE SAME NAME IS CALLED THEY ARE SAID TO BE FUNCTION OVER LOADING.
Is This Answer Correct ? | 0 Yes | 1 No |
What are different oops concepts?
//what is wrong with the programme?? #include<iostream.h> template <class first> class dd { first i; public: void set(); void print(); }; void dd< first>:: set() { cin>>i; } void dd< first>::print() { cout<<"\n"<<i; } void main() { dd <char>g; g.set(); g.print(); }
what is the 3 types of system development life cycle
Can you inherit a private class?
What is the Advantage of Interface over the Inheritance in OOPS?
Can we create object of interface?
What is operator overloading? Give Example
11 Answers CTS, IBM, TCS,
How does polymorphism work?
What are benefits of oop?
What is the real life example of polymorphism?
What is abstract class in oops?
How to overload postfix operator in c++