
Generics classes are further sub divided into two types on the basis of there declaration:
- Open-Constructed Generic:- These are those classes where the input parameters are defined as “T”. E.g. MyGenericClass<T> where T is the parameter that is passed to the MyGenericClass.
- Closed- Constructed Generic:- A generic Class that uses no parameterized types is called closed constructed generic classes. For e.g. MyGenericClass2<int> is closed constructed generic class.
Inheritance:
Inheritance is the process of extending or inheriting the features or behavior of one class into another class. We can say that inheritance is the process, by which one class inherits the behavior/features /functionality of other class.
Inheritance in Generic Classes:
- Inheriting closed constructed generic class into open constructed generic class.
example:- public class MyGenericClass2<T>: MyGenericClass1<int>{} - Inheriting open constructed type is possible only if it has parameters associated to it.
example:- public class MyGenericClass2<T>: MyGenericClass1<T> {} - Non generic classes: Non-generic classes can be derived from closed constructed generic classes.
example:- public class MyGenericClass2: MyGenericClass1<int> {}
Non-generic classes: Non-generic classes can't be derived from open constructed generic classes.
example:- public class MyGenericClass2: MyGenericClass1<T> {}
Dotnet Discussion
- - Web application
- - Great Indian Developer Su
- - Aspx page inside Silverli
- - Open aspx page inside Sil
- - Guidance for a novice




