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!

+11

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

6/27/2016 9:49:41 AM

William

18 Answers

New Answer

+14

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..."

+8

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

+6

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

+1

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

have a look at return values -it's a clear bool variable

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

-1

im confusing. Where its name?

-1

public static T operator - (T a, T b) { T res = new T(a.num - b.num); return res; } AllMapsImagesNewsVideosMore SettingsTools

-2

public _______T -_____ (T a, T b) { T res = new T(a.num - b.num); res; }