Difference between Operator overloading and Functional
overloading?
Answers were Sorted based on User's Feedback
Function overloading is like you have different functions
with the same name but different signatures working
differently. So, the compiler can differentiate and find
out which function to call depending on the context. In
case of operator overloading, you try to create your own
functions which are called when the corresponding operator
is invoked for the operands.
One important thing to understand is that you can create as
many functions as you want with the same name and sifferent
signatures so that they can work diffrently but for a
particular class, you cannot overload the operator function
based on number of arguments. There is a fundamental reason
behind this.
According to the rules, you can not create your own
operators but you have to use already available operators.
Another thing is since the operator are already defined for
use with buily-in types you can not change their
charecteristics. For example the binary operator '+' always
takes two parameters, so for this you cannot create a
function that takes three parameters. But you can always
overload them based on the type of the parameters.
Is This Answer Correct ? | 115 Yes | 14 No |
Answer / archana
FUNCTION OVERLOADING IS THE CONCEPT TO USE SAME FUNCTION
NAME <OF OUR OWN CHOICES> WITH DIFFERNT ARGUMENTS.......
AND......
OPERATOR OVERLOADING IS TO USE THE EXITING OPERATORS TO
OVERLOAD EXCEPT THE FIVE OPERATORS...
Is This Answer Correct ? | 42 Yes | 16 No |
Answer / rajkumar tyagi
Function overloading is like you have different functions
with the same name but different signatures working
differently. So, the compiler can differentiate and find
out which function to call depending on the context. In
case of operator overloading, you try to create your own
functions which are called when the corresponding operator
is invoked for the operands.
One important thing to understand is that you can create as
many functions as you want with the same name and sifferent
signatures so that they can work diffrently but for a
particular class, you cannot overload the operator function
based on number of arguments. There is a fundamental reason
behind this.
According to the rules, you can not create your own
operators but you have to use already available operators.
Another thing is since the operator are already defined for
use with buily-in types you can not change their
charecteristics. For example the binary operator '+' always
takes two parameters, so for this you cannot create a
function that takes three parameters. But you can always
overload them based on the type of the parameters.
Is This Answer Correct ? | 24 Yes | 16 No |
Answer / rock
we use predefined operators like +,-,* etc.. to perform
operations only between normal variables even in order to
perform between user defined variables we use operator
overloading.
when two or more functions having same name but different
signatures we use function overloading.
Here compiler uses NAME MANGLING to differentiate between the
functions.
Is This Answer Correct ? | 17 Yes | 11 No |
Answer / ok
Function overloading is like you have different functions
with the same name but different signatures working
differently. So, the compiler can differentiate and find
out which function to call depending on the context. In
case of operator overloading, you try to create your own
functions which are called when the corresponding operator
is invoked for the operands.
One important thing to understand is that you can create as
many functions as you want with the same name and sifferent
signatures so that they can work diffrently but for a
particular class, you cannot overload the operator function
based on number of arguments. There is a fundamental reason
behind this.
According to the rules, you can not create your own
operators but you have to use already available operators.
Another thing is since the operator are already defined for
use with buily-in types you can not change their
charecteristics. For example the binary operator '+' always
takes two parameters, so for this you cannot create a
function that takes three parameters. But you can always
overload them based on the type of the parameters.
Is This Answer Correct ? | 16 Yes | 11 No |
Answer / nsit@salem
C++ provides more than 35 operators, covering basic
arithmetic, bit manipulation, indirection, comparisons,
logical operations and others. Almost all operators can be
overloaded for user-defined types, with a few notable
exceptions such as member access (. and .*) as well as the
conditional operator. The rich set of overloadable operators
is central to using C++ as a domain-specific language. The
overloadable operators are also an essential part of many
advanced C++ programming techniques, such as smart pointers.
Overloading an operator does not change the precedence of
calculations involving the operator, nor does it change the
number of operands that the operator uses (any operand may
however be ignored by the operator, though it will be
evaluated prior to execution). Overloaded "&&" and "||"
operators lose their short-circuit evaluation property.
Operators that cannot be overloaded
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / chandu
Function overloading is like you have different functions
with the same name but different signatures working
differently. So, the compiler can differentiate and find
out which function to call depending on the context. In
case of operator overloading, you try to create your own
functions which are called when the corresponding operator
is invoked for the operands.
One important thing to understand is that you can create as
many functions as you want with the same name and sifferent
signatures so that they can work diffrently but for a
particular class, you cannot overload the operator function
based on number of arguments. There is a fundamental reason
behind this.
According to the rules, you can not create your own
operators but you have to use already available operators.
Another thing is since the operator are already defined for
use with buily-in types you can not change their
charecteristics. For example the binary operator '+' always
takes two parameters, so for this you cannot create a
function that takes three parameters. But you can always
overload them based on the type of the parameters.
Is This Answer Correct ? | 10 Yes | 6 No |
Answer / jknjkjk
Function overloading is like you have different functions
with the same name but different signatures working
differently. So, the compiler can differentiate and find
out which function to call depending on the context. In
case of operator overloading, you try to create your own
functions which are called when the corresponding operator
is invoked for the operands.
One important thing to understand is that you can create as
many functions as you want with the same name and sifferent
signatures so that they can work diffrently but for a
particular class, you cannot overload the operator function
based on number of arguments. There is a fundamental reason
behind this.
According to the rules, you can not create your own
operators but you have to use already available operators.
Another thing is since the operator are already defined for
use with buily-in types you can not change their
charecteristics. For example the binary operator '+' always
takes two parameters, so for this you cannot create a
function that takes three parameters. But you can always
overload them based on the type of the parameters.
Is This Answer Correct ? | 13 Yes | 16 No |
Answer / r
Function overloading is when a class inherits from another class and codes a functionality for a function defined in the base class.
Operator overloading is when the default behaviour of operators (+, =, ==, etc.) is modified by user defined actions.
Thanks.
Is This Answer Correct ? | 0 Yes | 5 No |
Can comments be nested?
What do you mean by abstraction in C++?
What are pointer-to-members? Explain.
What are protected members in c++?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
What is const pointer and const reference?
What is lambda in c++?
What is the difference between stack and heap memory?
Explain the use of vtable.
What is the difference between "overloading" and "overridding"?
Does defining a function inline mean that it wont push and pop things on/off the stack ...like parameters and the return the address??
In what situations do you have to use initialization list rather than assignment in constructors?