Why is there no parameter contra-variance for overriding?

后端 未结 6 1175
借酒劲吻你
借酒劲吻你 2020-12-02 20:36

C++ and Java support return-type covariance when overriding methods.

Neither, however, support contra-variance in parameter types - instead, it translates to overl

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 21:27

    Although this is a nice-to-have in any oo language, I still need to encounter it's applicability in my current job.

    Maybe there isn't really a need for it.

提交回复
热议问题