当前位置:网站首页>The difference between abstract classes and interfaces
The difference between abstract classes and interfaces
2022-07-06 13:39:00 【Wake up duck, did you program today?】
First, let's look at abstract classes , What is an abstract class ?
1、 Abstract classes don't necessarily have abstract methods , Abstract classes must have keywords abstract To modify
2、 If a class contains abstract methods , So this class must be an abstract class
3、 Abstract classes cannot be used final Embellishment stands for , Because abstract classes are used for inheritance , however final Modified representative cannot be modified , Non inheritable
The difference between interface and abstract class ?
1、 A subclass can only inherit one abstract class , But you can implement multiple interfaces
2、 Abstract classes have construction methods , Interface has no constructor
3、 Abstract classes can have common member variables , There cannot be
4、 Abstract classes and interfaces can have static member variables , But member variables in abstract classes can be of any type , The interface can only be public static final( Default )
5、 There doesn't have to be an abstract method in an abstract class , But the methods in the interface must be abstract
6、 Abstract classes can have static methods , There cannot be static methods in an interface
7、 The methods in an abstract class can be public、protected, Methods in an interface can only be public
边栏推荐
- 12 excel charts and arrays
- (超详细onenet TCP协议接入)arduino+esp8266-01s接入物联网平台,上传实时采集数据/TCP透传(以及lua脚本如何获取和编写)
- 凡人修仙学指针-1
- vector
- 一段用蜂鸣器编的音乐(成都)
- 【手撕代码】单例模式及生产者/消费者模式
- The latest tank battle 2022 - Notes on the whole development -2
- [hand tearing code] single case mode and producer / consumer mode
- [面试时]——我如何讲清楚TCP实现可靠传输的机制
- View UI Plus 发布 1.3.1 版本,增强 TypeScript 使用体验
猜你喜欢
随机推荐
一段用蜂鸣器编的音乐(成都)
【九阳神功】2020复旦大学应用统计真题+解析
FAQs and answers to the imitation Niuke technology blog project (II)
编写程序,模拟现实生活中的交通信号灯。
优先队列PriorityQueue (大根堆/小根堆/TopK问题)
4. Binary search
【毕业季·进击的技术er】再见了,我的学生时代
JS interview questions (I)
强化学习系列(一):基本原理和概念
View UI Plus 发布 1.2.0 版本,新增 Image、Skeleton、Typography组件
There is always one of the eight computer operations that you can't learn programming
4.二分查找
2. C language matrix multiplication
MySQL中count(*)的实现方式
3. C language uses algebraic cofactor to calculate determinant
Questions and answers of "Fundamentals of RF circuits" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
View UI plus released version 1.3.1 to enhance the experience of typescript
最新坦克大战2022-全程开发笔记-2
View UI plus releases version 1.1.0, supports SSR, supports nuxt, and adds TS declaration files
Questions and answers of "basic experiment" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology