98-361 · Question #378
You are creating a new class named Polygon. You write the following code: class Polygon : IComparable { public double Length { get; set; } public double Width { get; set; } public double GetArea() {…
Sign in or unlock 98-361 to reveal the answer and full explanation for question #378. The question stem and answer options stay visible for context.
Question
You are creating a new class named Polygon. You write the following code:
class Polygon : IComparable { public double Length { get; set; } public double Width { get; set; } public double GetArea() { return Length * Width; } public int CompareTo(object obj) { // to be completed } } You need to complete the definition of the CompareTo method to enable comparison of the Polygon objects. Which of the following code segments should you use?
Options
- Apublic int CompareTo(object obj)
- Bpublic int CompareTo(object obj)
- Cpublic int CompareTo(object obj)
- Dpublic int CompareTo(object obj)
Unlock 98-361 to see the answer
You've previewed enough free 98-361 questions. Unlock 98-361 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.