Hi everyone!
First of all I want to apologize if this is some kind of repost. Unfortunately I don't even know what keywords to search. I have something like this:
abstract class BaseValueClass { ... }
class IntegerValue : BaseValueClass {
public int CompareTo(IntegerValue integerValue) {...}
}
class StringValue : BaseValueClass {
public int CompareTo(StringValue stringValue) {...}
}
It's a dumb example, I know. But it is a simple way to explain what I want do achieve. Now, I have a collection:
List<BaseValueClass> valueList = ...;
I want to iterate all the items in valueList and I want to call the CompareTo method. How can I achieve this? How can I declare the CompareTo method in the BaseValueClass and override it in the derived classes, knowing that this method will have diferrent parameters in each one of the derived classes?
Thanks!