You can understand generics as some kind of general template for separate types that all work the same but are different.
In your case, ChildA
inherits from Parent<ChildA>
, and ChildB
inherits from Parent<ChildB>
. The two parent types, Parent<ChildA>
and Parent<ChildB>
, are different though, so ChildA
and ChildB
do not have a common base type.
It is probably easier to understand, if you actually declare Parent<ChildA>
and Parent<ChildB>
as real separate types:
class Parent_ChildA { … }
class Parent_ChildB { … }
class ChildA : Parent_ChildA { … }
class ChildB : Parent_ChildB { … }
This is what really happens behind the scenes. So the two parent types are separate types, which also explains why they have separate static members. Two different classes wouldn’t share static members after all, even if they have the same name.