CJCoding With Joseph

Implement IComparable

Make Person implement IComparable<Person> by ordering people by Age ascending. Once CompareTo is defined, List<Person>.Sort() can sort them polymorphically. Do NOT write a Main method.

After sorting people aged 30, 20, 25 the program prints:
B 20
C 25
A 30

Expected Output:

B 20
C 25
A 30
Topics:
Polymorphism
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.