0
Fill in the blanks to overload the greater than operator for the Box class. (C#)
public static .................. operator...... (Box a,Box b) { if (a.Height*a.Width > b.Height*b.Width) return true; else return false; }
7 odpowiedzi
+ 1
public static bool operator > (Box a, Box b) {
if (a.Height * a.Width > b.Height * b.Width) {
return true;
} else {
return false;
}
}
+ 2
How is your question?
+ 2
A hint for you, Katchi Mohamed Mohamed Hanan :
When methods have the same name, but different parameters, it is known as method overloading. About overloading can be learnd here quite at the end of Java Tutorial in a part with „classes“.
Additional you could look carefully on the method and think for example what will be there returned and what means that for the appearance of the method etc.
+ 2
Now I see c#, but my answer is the same and as Ipang already said. Reading carefully again and try to code, this is the way.
0
This is the question JaScript
0
This is not java question it's c# JaScript
0
When having difficulty in lesson quiz, it uaually helps to take a step back and re-read the relevant chapter. It's all there if we just look carefully.
Yet again, it can't hurt to check the docs for more details, and examples
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading