Enforce “equals” in an interface

前端 未结 6 1225
醉酒成梦
醉酒成梦 2021-02-15 04:06

I have an interface and I want everyone who implements this interface to implements an overrridden \"equals\" method.

Is there a way to make sure that happens?

6条回答
  •  Happy的楠姐
    2021-02-15 04:41

    No. An interface is a contract guaranteeing that methods exists.

    There is no mechanism for enforcing that methods should be overridden in an interface.

提交回复
热议问题