The I’m-My-Own-Grandpa Design Pattern
I wrote about this a few months back, and today it proved the solution to an otherwise insoluble problem yet again.
class BaseMarklar<T> where T:BaseMarklar<T> {
public T Self() { return (T)this; }
}
class BlueMarklar : BaseMarklar<BlueMarklar> {
public void Frob() { ... }
}
class RedMarklar : BaseMarklar<RedMarklar> {
public void Frizzle() { ... }
}
I’ve decided to call it the “I’m My Own Grandpa” design pattern. I’ve always regarded design patterns as primarily solutions to failures of the underlying language, and hence I consider the designation appropriate here.