Consider this example in C#:
class C<T> {
void greetMe() { print("Hello you"); }
}
class D : C<E> {
void useE(E e) {
e.greetMe();
}
}
class E : C<D> {
void useD(D d) {
d.greetMe();
}
}
Is an equivalent construction possible in C++ using templates?
I don't have any useful C++ code to show, since my interest in this is purely academic. You can consider this code as pseudocode.
For the curious: I was examining restrictions of eager languages to handle circular references, as opposed to lazy languages. I remembered that something like this is possible in C#'s type system, which I'm attempting to view as a statically checked lazy language. I remembered that C++'s templates are the exact opposite (but still somewhat functional?), which I thought might be an interesting study.
Thank you for your time!