Generic Interfaces
I am having trouble implementing a method in my class that I derived from my Generic interface using T data type.
IComparableType
Shape
10 Replies
NOTE: IK IT LOOKS WEIRD BUT MY PROF CODES THIS WAY, SO DON'T WORRY ABOUT HOW FUNKY SOME THINGS LOOK. HE'S OLD SCHOOL
my issue is where the commented "if statements" are in my shape class
the example he gave was " if x.CompareTo(y) < 0, return -1"
I am unsure how to do that here since there's no data fields
I guess it's supposed to compare areas?
That
Area()
method I guess serves as some sort of a Java-ism for a getteromg slay i remember u
u helped me out a lot last time
ur like super smart
yes it is comparing areas
your professor doesn't know that IComparable<T> already exists?
heres the instructions he gave
if this will help
it's an intro to generic interfaces and T datatypes
so im sure he's already aware
omg oops
wrong class hold ong
this is the instructions for the shape class if this helps
yeah so you just have to implement CompareTo for Shape
i was able to figure it out
tysm !