+ 8
Fill in the blanks to overload the greater than operator for the Box class. public static ____ operator __(Box a,Box b) { if (a.Height*a. Width > b.Height*b.Width) ______ true; else return false; } The blank space for "Box" have 4 char spaces, it wont let me pass!
Operator Overloading Question Bug
22 Antworten
+ 19
try "bool" there. its not a bug. plz someone explain it, Im bad at dis :v
edit: By logic, I said "it returns true or false so..."
+ 9
first check what is the return type . As u can see return type is boolean value like true or false so method return type should be bool
+ 7
public static bool operator>(Box a,Box b) {
if (a.Height*a.Width > b.Height*b.Width)
return true;
else
return false;
}
+ 3
Yes, I was confused, now I now that is the return type! Thanks!
+ 3
public static bool operator>(Box a,Box b) {
if (a.Height*a.Width > b.Height*b.Width)
return true;
else
return false;
}
+ 1
Great insight guys
+ 1
great! tumor12.
+ 1
static, operator, return heheh hope it helps
0
have a look at return values -it's a clear bool variable
0
the example got me too. the Box in the example is not class name, it is the return type. the example just happened to return a (new) Box.
0
public static Bool_ operator _>_(Box a,Box b) {
if (a.Height*a. Width > b.Height*b.Width)
_return__ true;
else
return false;
0
Fill in the blanks to overload the greater than operator for the Box class. public static _bool___ operator >__(Box a,Box b) { if (a.Height*a. Width > b.Height*b.Width) __return____ true; else return false; } The blank space for "Box" have 4 char spaces, it wont let me pass!
0
try:
bool and >
0
public static
bool
operator
>
(Box a,Box b) {
if (a.Height*a.Width > b.Height*b.Width)
return
true;
else
return false;
}
0
Public static bool operator>(Box a, Box b) {
If( a.height*a . Width >b.height*b . Width)
return true ;
else
return false;
}
0
nhfbnajhsfnajnjnfisjn nnnnnnnnooooooooooo
0
bool
>
return
0
public static bool operator>(Box a,Box b)
{
if (a.Height*a.Width > b.Height*b.Width)
return
true;
else
return false;
}
0
public
_______T
-_____ (T a, T b) {
T res = new T(a.num - b.num);
res;
}
ANS: static/ operator/ return
- 1
im confusing. Where its name?