为什么我们需要界面? [英] why we need interface?

查看:114
本文介绍了为什么我们需要界面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们可以使用抽象类而不是接口。抽象类有抽象和非抽象方法可用。为什么我们需要接口。你可以说在单个类中实现多个接口。我们可以有单个抽象类并继承到另一个类。

请用例子清楚地解释我。

Hi,

we can use abstract class instead of interface. abstract class have abstract and non abstract methods are available. why we need interface. You can say like implement multiple interface in single class. we can have single abstract class and inherit to another class.
please explain me clearly with example.

推荐答案

请阅读:< a href =http://www.codeproject.com/Articles/11155/Abstract-Class-versus-Interface>抽象类与接口 [ ^ ]和:抽象类与接口的建议 [ ^ ]
Please, read this: Abstract Class versus Interface[^] and this: Recommendations for Abstract Classes vs. Interfaces[^]


这篇关于为什么我们需要界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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