覆盖/禁用超级接口方法 [英] Override / Disable super-interface method

查看:113
本文介绍了覆盖/禁用超级接口方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑接口

public interface SuperInterface {

  public void execute(Map<String,object> argument);

}

public interface SubInterface extends SuperInterface {

  public void execute(Argument extra , Map<String,Object> args);

}

是否可以完全覆盖 SuperInterfaces.execute SubInterface.execute 即使它有不同的参数?

Is it possible to completely override SuperInterfaces.execute with SubInterface.execute even though it has different arguments ?

OR

我做错了吗?设计此规范的正确方法是什么?

Am I doing it wrong ? What is the right way to design this spec ?

推荐答案


是否可以完全覆盖SuperInterfaces。使用
SubInterface.execute执行,即使它有不同的参数?

Is it possible to completely override SuperInterfaces.execute with SubInterface.execute even though it has different arguments ?

如果你被允许这样做,你将会违反达成协议。

If you are allowed to do this, you will breach an agreement.


我做错了吗?

Am I doing it wrong ?

是的,当然。


设计此规范的正确方法是什么?

What is the right way to design this spec ?

您不能违反协议。所以,你不能这样做。

You can't disobey an agreement. So, you can't do like this.

这篇关于覆盖/禁用超级接口方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆