当接口的主体也在实现它的类中定义时,我们可以使用接口中定义的3种方法中的2种方法吗? [英] Can we use 2 methods out of 3 methods defined in interface when its body is also defined in class implementing it.

查看:59
本文介绍了当接口的主体也在实现它的类中定义时,我们可以使用接口中定义的3种方法中的2种方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们有一个接口并有3个方法,并且在实现它的类中也实现了这3个方法的主体,那么我们只能在这3个方法中仅使用2个方法吗? class ="h2_lin">解决方案

您不必全部使用它们,但您必须全部使用它们.


是的,肯定是的,
但是您必须实现所有这些.
只需输入方法名称,然后输入空白{}.


If we have one interface and having 3 methods in it and we have also implemented the body of these 3 methods in the class implementing it.So can we use only 2 methods out of these 3 methods.Is it possible?

解决方案

You don''t have to use them all, but you DO have to implement them all.


Yes definitely,
But you should have to implement all of those.
Just put the method name, and put blank {}.


这篇关于当接口的主体也在实现它的类中定义时,我们可以使用接口中定义的3种方法中的2种方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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