S
Simon
Hi folks,
Take the following scenario:
public class BaseType {
}
public class DerivedTypeA : BaseType {
int _length;
public int Length {
get { return _length; } set { _length = value; }
}
}
public class DerivedTypeB : BaseType {
int _lowBound;
int _highBound;
public int LowBound {
get { return _lowBound; } set { _lowBound = value; }
}
}
public class BaseTypeCollection : BindingList<BaseType> {
}
An instance of the collection will contain various instances of the two
derived types and in the future many more derived types. At various
times I need to iterate through each item setting various values.
I can see a problem in that I still need to test within an iteration
routine the actual type of each instance, which to me sort of defeats
the reason for deriving from a base class in the first place.
Comments welcome.
Cheers
Simon
Take the following scenario:
public class BaseType {
}
public class DerivedTypeA : BaseType {
int _length;
public int Length {
get { return _length; } set { _length = value; }
}
}
public class DerivedTypeB : BaseType {
int _lowBound;
int _highBound;
public int LowBound {
get { return _lowBound; } set { _lowBound = value; }
}
}
public class BaseTypeCollection : BindingList<BaseType> {
}
An instance of the collection will contain various instances of the two
derived types and in the future many more derived types. At various
times I need to iterate through each item setting various values.
I can see a problem in that I still need to test within an iteration
routine the actual type of each instance, which to me sort of defeats
the reason for deriving from a base class in the first place.
Comments welcome.
Cheers
Simon