How does shared inheritance work on this type?

 public class Leaf : IComponent<Leaf>
 {
     //...
 }

Does this type of universal inheritance mechanism have any specific name?

What is the advantage of this type of generic use?

+3
source share
4 answers

I don’t have a specific name,

The real benefit, as I see it, and, like all generics, is type safety. Using a common interface, you guarantee that the methods implemented are type safe (at least in their definitions).

In my opinion, there is no real reason to use "normal" interfaces if there is a common version.

+4
source

, . , , ; , .

, AP Erebus; .

+3

++, , " ".

+2

, . , #, , , Enum Java. (, exampleEnum) Enum<exampleEnum>. , .

0

Source: https://habr.com/ru/post/1723593/


All Articles