当前位置:网站首页>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
边栏推荐
- 杂谈0516
- 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
- [面試時]——我如何講清楚TCP實現可靠傳輸的機制
- C language Getting Started Guide
- 3. Number guessing game
- 1.初识C语言(1)
- Leetcode.3 无重复字符的最长子串——超过100%的解法
- 3.猜数字游戏
- Questions and answers of "signal and system" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
- 4. Binary search
猜你喜欢
1. C language matrix addition and subtraction method
4.二分查找
仿牛客技术博客项目常见问题及解答(一)
View UI plus released version 1.3.0, adding space and $imagepreview components
This time, thoroughly understand the MySQL index
Smart classroom solution and mobile teaching concept description
View UI Plus 发布 1.3.0 版本,新增 Space、$ImagePreview 组件
关于双亲委派机制和类加载的过程
Questions and answers of "basic experiment" in the first semester of the 22nd academic year of Xi'an University of Electronic Science and technology
There is always one of the eight computer operations that you can't learn programming
随机推荐
View UI plus released version 1.3.1 to enhance the experience of typescript
6. Function recursion
The latest tank battle 2022 - Notes on the whole development -2
View UI Plus 发布 1.1.0 版本,支持 SSR、支持 Nuxt、增加 TS 声明文件
8.C语言——位操作符与位移操作符
Write a program to simulate the traffic lights in real life.
【九阳神功】2022复旦大学应用统计真题+解析
View UI Plus 發布 1.3.1 版本,增强 TypeScript 使用體驗
Share a website to improve your Aesthetics
Leetcode.3 无重复字符的最长子串——超过100%的解法
20220211-CTF-MISC-006-pure_ Color (use of stegsolve tool) -007 Aesop_ Secret (AES decryption)
学编程的八大电脑操作,总有一款你不会
仿牛客技术博客项目常见问题及解答(一)
vector
【九阳神功】2020复旦大学应用统计真题+解析
Pit avoidance Guide: Thirteen characteristics of garbage NFT project
12 excel charts and arrays
C语言实现扫雷游戏(完整版)
(super detailed II) detailed visualization of onenet data, how to plot with intercepted data flow
Caching mechanism of leveldb