A derived class with its own type parameters
using System;
class MyClass<T> {
T ob;
public MyClass(T o) {
ob = o;
}
public T getob() {
return ob;
}
}
class ClassA<T, V> : MyClass<T> {
V ob2;
public ClassA(T o, V o2) : base(o) {
ob2 = o2;
}
public V getob2() {
return ob2;
}
}
class Test {
public static void Main() {
ClassA<string, int> x = new ClassA<string, int>("Value is: ", 9);
Console.Write(x.getob());
Console.WriteLine(x.getob2());
}
}
Related examples in the same category