Possible and impossible subclasses of Set classes. | Lecture 11 - slide 16 : 21 Program 1 |
using System; // A generic subclass of a non-generic superclass. class SomeGenericSet1<T>: IntSet{ // ... } // A generic subclass of a constructed superclass class SomeGenericSet2<T>: Set<int>{ // ... } // A generic subclass of a generic superclass // The most realistic case class SpecializedSet<T>: Set<T>{ // ... } // A non-generic subclass of a generic superclass // Illegal. Compile-time error: // The type or namespace name 'T' could not be found class Set: Set<T>{ // ... } |