A simple generic class hierarchy
using System;
class GenericClass<T> {
T myObject;
public GenericClass(T o) {
myObject = o;
}
public T getmyObject() {
return myObject;
}
}
class GenericClass2<T> : GenericClass<T> {
public GenericClass2(T o) : base(o) {
}
}
class Test {
public static void Main() {
GenericClass2<string> g2 = new GenericClass2<string>("www.java2s.com");
Console.WriteLine(g2.getmyObject());
}
}
Related examples in the same category