I recently stumbled upon code that looks like this and I can't wrap my head around it:
template<typename T>
class A
{
}
class B: A<B>
{
}
So my general questions are:
- Why does this not give a compile error? Specifically how can class
B
inherit from the template classA<B>
, ifB
hasn't even been defined yet? - When would this structure ever be necessary?