How to restrict types which are allowed as “T” in a generic class?

后端 未结 1 1829
谎友^
谎友^ 2021-01-21 04:24

I\'ve got a class Foo. How can I say that I want T to be some class implementing BarInterface? Writing simply class Foo<

1条回答
  •  花落未央
    2021-01-21 05:08

    Use extends instead of implements.

    0 讨论(0)
提交回复
热议问题