answersLogoWhite
notificationBell

Top Answer
User Avatar
Wiki User
Answered 2010-03-19 18:56:50
Operator overloading

The mechanism of giving special meanings to an operator is known as operator overloading.It provides a flexible option for the creation of new definitions for most of the C++ operators. we can almost create a new language of our own by the creative use of the function and operator overloading techniques.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Related Questions


What are the disadvantages of operator overloading in c plus plus?


There is no operator overloading in C. This is only a C++ thing.


No. Operator and/or function overloading is only a C++ thing.


one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


C does not support operator overloading. If you mean C++ operator overloading, it depends on exactly what you wanted to do. If you wanted to '+' to strings, then you could write: string operator+(string a, string b) { // do something }



You cannot overload operators in C. This is a C++ thing only.


To overload an operator. ie to write operator functions


There is no memory management operator in C++ -- it is an unmanaged language. You use the C++ new operator to allocate memory, and use the C++ delete operator to release previously allocated memory.


There is no "power" operator in C or C++. You need to the use the math library function pow().


Function overloading is multiple definition with different signatures(the parameters should be different) for the same function. The parameter list have to be different in each definition. The compiler will not accept if the return type alone is changed. Operator overloading is defining a function for a particular operator. The operator loading function can not be overloaded through function overloading.


There is no concept of operator overloading in java, at least it is not available to the developers. There are still instances of operator overloading as in the case of "+" operator. It is used both to perform arithmetic sum as well as concatenation of two strings. But one cannot impart additional functions to an existing operator as in the case of C++.


class complex { private: double real; double imaginary; public: complex() {...} // constructor, etc. operator+(const& complex a) { // operator plus this->real += a.real; this->imaginary += a.imaginary; } }


In C and in C++, the ++ operator means to increment. C++ was intended to be the next version, i.e. the incremental next step, of C, hence the use of the ++ operator.


one function but multiple behaviours depending on the parameters


conditional operator , size of operator , membership operator and scope resulation operator can not be overload in c++


Operator overloading allows us to provide new implementations for existing operators. Not all languages support operator overloading; C does not, but C++ does. All languages provide built-in operators, however these operators cannot cater for user-defined types (they only work on built-in types). Operator overloading allows us to add this (missing) functionality so we can operate upon user-defined types as intuitively as we can with built-in types. In languages that do not support operator overloading, user-defined functions can be used instead of operators, but they are much less intuitive.


Operator overloading allows c/c++ operators to have user defined meanings on user defined types. For example + operator is used to add to numbers but we can also use it for concatenating a string the only limitation is you cannot change the literal meaning of the operator.


I will not use operator overloading in C# to do anything. Operator overloading may lead to one operator has more than 1 semantic meaning. For example, we know 1 + 2 yields 3, and "1" + 2 yields "12". I do not like this overloading of the operator + being used for addition in Number hierarchy, while as the concatenation in strings. That is, one operator (+) has 2 significant semantics.And the question "find largest of two object" is too vague - what do you mean "largest"? and object? We know apple and orange are 2 objects, but how do you compare them, and find the largest one?????? (size, price or what???)


The boolean and operator in C and C++ is &&a 4 // relationalThe bitwise and operator in C and C++ is &maskresult = maskinput & maskvalue // bitwise



They perform bitwise operations like AND (&), OR (|), XOR (^) and NOT (~).


In C, the ++ operator is an increment operator. The C++ language was conceived as an enhancement to C, so C++ means "the next incremental version of C".


input is the << operator and output is the >> operator


We use the delete operator to release a memory resource that was previously allocated using the new operator.