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 use of classes in c++;
What is this interview room ? Is it a class or an object.
What is the difference between Home and $Home?
WHAT'S THE OOPS BASIC OOPS CONCEPTS IN DOTNET
what is multi level inheritance give n example ?
13 Answers HDFC, Hulas Steel, Ness Technologies,
to find out the minimum of two integer number of two different classes using friend function
is java purely oop Language?
49 Answers HCL, Infosys, TCS,
What is class and object in oops?
In OverLoading concept,Why they are not consider return value and why they are consider only parameters in method? For ex: public int Add(int a,int b){...} public String Add(int a,int b){...}
Write pseudo code for push in a stack?
What is a scope operator and tell me its functionality?
WHEN A COPY CONSTER IS CALL ?