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