what is a binary overloading
Answers were Sorted based on User's Feedback
Answer / badmoon
Overloading binary operators (C++ only)
You overload a binary unary operator with either a nonstatic
member function that has one parameter, or a nonmember
function that has two parameters. Suppose a binary operator
@ is called with the statement t @ u, where t is an object
of type T, and u is an object of type U. A nonstatic member
function that overloads this operator would have the
following form:
return_type operator@(T)
A nonmember function that overloads the same operator would
have the following form:
return_type operator@(T, U)
An overloaded binary operator may return any type.
The following example overloads the * operator:
struct X {
// member binary operator
void operator*(int) { }
};
// non-member binary operator
void operator*(X, float) { }
int main() {
X x;
int y = 10;
float z = 10;
x * y;
x * z;
}
The call x * y is interpreted as x.operator*(y). The call x
* z is interpreted as operator*(x, z).
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / sandhya.v
When u overload a nonstatic member with single parameter
or nonmember with more than one parameter with the same
name ..
| Is This Answer Correct ? | 3 Yes | 1 No |
What is the difference between inheritance and polymorphism?
what is the main difference between sizeof() operator in c and c++
What type of Job you are providing?
Write on signed and unsigned integers and give three (3) examples each
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
Can we have inheritance without polymorphism?
When not to use object oriented programming?
c++ is a purely oop concept?
What is the purpose of polymorphism?
write a C++ program for booking using constructor and destructor.
diff between Virtual mathod and abstract method?
monkey starts climbing up a tree 20ft tall,each hour ,it hops 3ft and slips back by 2ft .how much time it wil tak to reach top of the tree?