Generic Types vs Abstract class/Interfaces
abstract-class, generics, interface
Solution
I think you a little bit confused. Generic types and abstract classes/interfaces serve different goals for different approaches in application design. Abstract classes/interfaces are for generalization of common functionality of a group of entities. Later on this API could be implemented differently, but since polymorphism is involved it will not impact anyone.
On other hand, sometimes you have a very similar implementation of something and the only difference is the type of the objects you are working with. Here you will need a generic. You could use polymorphism, but there is no need. For that purpose it's much clearer just to define an interface, make an implementation, and let the end user decide which kind of object to use.
The best example is List, where the main purpose of list is to store elements. The List implementor should not care which type of objects you are going to use, so later you will be able just define List and make use of integer list.
Problem
Suppose we are creating a generic control in .NET. E.g. a tree. I don't understand why people use this generic type definition ``` Control<T> ``` when in Object Oriented Programming I can use an abstract class or an interface: ``` Control<IItem> or Control<BaseClass> ``` So the only thing to do is that, their types must derive from that base class or implement the interface. Does it mean, that generic types are more convenient, because you I don't have to implement or inherit anything?