The following is contrived, but bear with me:
interface Clonable<TSubClass>
{
TSubClass Clone();
}
How can I restrict TSubClass to be of the implementing type?
i.e only let the implementor do this:
class Dog : Clonable<Dog>
{
Dog Clone()
{
....
}
}
Not this:
class BadDog : Clonable<Rabbit>
{
Rabbit Clone()
{
....
}
}