An interface provides a list of members, without an implementation, that a class can choose to implement. This is similar to an abstract class, which may include abstract methods that have no implementation in the abstract class, but might also include an implementation for some of its members.

One difference is that an abstract class might include some members that are fully implemented in the abstract class. Interface can't include the implementations of any of their members. An interface just describes what a class does, while an abstract class may define how something is done.

Another difference is that a class can inherit from multiple interfaces, but can inherit from at most one base class. Abstract classes allow you to treat an object polymorphically, based on any of the classes in its inheritance chain. Interfaces let you treat a class polymorphically, based on any of the interfaces it implements.

原文地址:#445 - Differences Between an Interface and an Abstract Class

最新文章

  1. 分享一个js中的bind方法使用
  2. python 变量命名规范
  3. HTML第六天学习笔记
  4. (转载)用SQL语句创建Access表
  5. PAT (Advanced Level) 1090. Highest Price in Supply Chain (25)
  6. Hibernate基础知识总结
  7. 锁对象Lock
  8. 关于Spring的注入方式
  9. centos7重置root密码
  10. 支持不同Android设备,包括:不同尺寸屏幕、不同屏幕密度、不同系统设置
  11. 【转载】浅谈事件冒泡与事件捕获 - javascript 事件代理
  12. 彻底征服 Spring AOP 之 实战篇
  13. MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause
  14. .NET Core开发日志——依赖注入
  15. Selenium Webdriver wait for JavaScript JQuery and Angular
  16. 10、Dockerfile实战-PHP
  17. Spring组件扫描 <context:component-scan/>
  18. 学习Mybatis的两个必须的jar包分享
  19. 【原】不定义Order属性,通过切面类的定义顺序来决定通知执行的先后顺序
  20. C++异常 返回错误码

热门文章

  1. 【网络】默认路由、RIPv2、OSPF、EIGRP配置(全网全通)
  2. Linux总线设备驱动模型
  3. git 填坑之 git 暂存区忽略文件
  4. quartz使用(整合spring)
  5. redis 网络架构
  6. mysql 显示树结构表的节点全路径
  7. 字典表+委托替代switch解决思路
  8. document.write与document.getElementById.innterHTML的区别
  9. VRRP协议介绍--转
  10. IE678不兼容CSS3 user-select:none(不可复制功能),需要JS解决