I want to create and abstract class A that implements IComparer so that I can implement different forms of comparing in the subclasses and later on do:
A sortBy = new B();
A sortBy2 = new C();
I'm new in C# and I don't quite get how to do that. I want them to implement this variations of this method:
int IComparer<Flower>.Compare(Flower a, Flower b)
{
if (a.leaves > b.leaves)
return 1;
if (a.leaves< b.leaves)
return -1;
else
return 0;
}
But I can't use abstract or override on it because it won't compile. Could you give me an idea of how to implement this? Thanks