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! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

27th Jun 2016, 9:49 AM
William
William - avatar
22 Answers
+ 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..."
29th Jun 2016, 1:52 AM
tumor12
+ 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
30th Jun 2016, 4:35 PM
Chandan Sharma
Chandan Sharma - avatar
+ 7
public static bool operator>(Box a,Box b) { if (a.Height*a.Width > b.Height*b.Width) return true; else return false; }
12th Mar 2017, 1:55 AM
Vira Yanchuk
Vira Yanchuk - avatar
+ 3
Yes, I was confused, now I now that is the return type! Thanks!
30th Jun 2016, 4:37 PM
William
William - avatar
+ 3
public static bool operator>(Box a,Box b) { if (a.Height*a.Width > b.Height*b.Width) return true; else return false; }
28th Mar 2019, 5:04 AM
Sridhar Raj.P
Sridhar Raj.P - avatar
+ 1
Great insight guys
28th Sep 2016, 6:21 PM
mugu macharia
mugu macharia - avatar
+ 1
great! tumor12.
11th Nov 2016, 1:20 PM
Gustavo Ernesto Martínez Cárdenas
Gustavo Ernesto Martínez Cárdenas - avatar
+ 1
static, operator, return heheh hope it helps
29th Jul 2021, 2:53 AM
Ailee T. Laginan
Ailee T. Laginan - avatar
0
have a look at return values -it's a clear bool variable
5th Aug 2016, 12:42 AM
Roberts L
Roberts L - avatar
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.
16th Nov 2016, 11:13 PM
Elfan
0
public static Bool_ operator _>_(Box a,Box b) { if (a.Height*a. Width > b.Height*b.Width) _return__ true; else return false;
23rd Nov 2016, 11:08 PM
Alpha Diallo
Alpha Diallo - avatar
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!
24th Sep 2017, 2:30 AM
Vaibhav Vaidya
Vaibhav Vaidya - avatar
0
try: bool and >
14th Dec 2017, 6:07 PM
Hubert Kanyamahanga
Hubert Kanyamahanga - avatar
0
public static bool operator > (Box a,Box b) { if (a.Height*a.Width > b.Height*b.Width) return true; else return false; }
8th Mar 2018, 1:33 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
0
Public static bool operator>(Box a, Box b) { If( a.height*a . Width >b.height*b . Width) return true ; else return false; }
4th Nov 2018, 8:24 AM
Manda Venkatasudheer Kumar
Manda Venkatasudheer Kumar - avatar
0
nhfbnajhsfnajnjnfisjn nnnnnnnnooooooooooo
19th Feb 2019, 3:58 PM
Aniket
0
bool > return
9th Feb 2021, 2:54 PM
Brinsley Demenezes
Brinsley Demenezes - avatar
0
public static bool operator>(Box a,Box b) { if (a.Height*a.Width > b.Height*b.Width) return true; else return false; }
11th Sep 2021, 11:03 AM
Jobayrul Hasan
Jobayrul Hasan - avatar
0
public _______T -_____ (T a, T b) { T res = new T(a.num - b.num); res; } ANS: static/ operator/ return
16th Apr 2022, 6:00 PM
Venura Dilshan Siriwardhana
Venura Dilshan Siriwardhana - avatar
- 1
im confusing. Where its name?
14th Oct 2016, 7:42 AM
serkan ünver
serkan ünver - avatar