Differences between abstract class and interface
2014-12-25 16:22
309 查看
1, 首先,abstract class 是类,故其子类和他的关系是" is a", 而后者是“like a ”。
2, 既然是is a 那自然不能说 is a A 的同时又说 is a B, 就是他们就是有遗传基因的,所以不能多重继承。 而"like a "就不一样了,可以 like a C 同时也可以 like a D.
3, 既然是由遗传基因的,那么自然可以有独门绝技了嘛, 也就是abstract class 可以有自己的非abstract 属性或者方法,而interface就只可能有一些常量之类的。
2, 既然是is a 那自然不能说 is a A 的同时又说 is a B, 就是他们就是有遗传基因的,所以不能多重继承。 而"like a "就不一样了,可以 like a C 同时也可以 like a D.
3, 既然是由遗传基因的,那么自然可以有独门绝技了嘛, 也就是abstract class 可以有自己的非abstract 属性或者方法,而interface就只可能有一些常量之类的。
相关文章推荐
- Difference between Abstract class and interface
- difference between Interface and abstract class in Java
- difference between abstract class and interface
- difference between Abstract class and interface in java
- What is difference between abstract class and interface
- 【转载】#445 - Differences Between an Interface and an Abstract Class
- difference between Abstract class and interface in java
- Difference between Abstract Class and Interface in Java
- Java - Difference between Abstract class and Interface
- What’s the difference between an interface and an abstract class in Java?
- the Differences between abstract class & interface in C#接口和抽象类的区别
- 【转载】#446 - Deciding Between an Abstract Class and an Interface
- Summary: Arrays vs. Collections && The differences between Collection Interface and Collections Class
- Different Between An Interface and An Abstract Class
- abstract class and interface
- Interface and abstract class
- Difference between ClassNotFoundException and NoClassDefFoundError
- Difference Between Class.forName() and ClassLoader.loadClass()
- Part 33 Difference between abstract classes and interfaces
- Interface and Abstract Class 区别