+ 2
What is the exact difference between abstract class and interface?
4 Antworten
+ 5
interference do you mean inheritance? Well abstract classes simply mean that you get the idea of it but not the specific stuff, for example: Book you know that it has covers but not the colors, you know it got pages but you do not know the value, In inheritance, you inherit methods and instances from the super class gaining access if it is protected or public.
0
what are you saying.???
- 1
abstract class is a class that contains at least one abstract method. abstract method is a method in which behaviour is not defined. you need to inherit it in order to instantiate.
interface is an implicitly abstract class a class which contains only abstract method. in order to instantiate those methods we need to inherit that but how can we inherit something in which nothing is defined, so we implement it.
- 1
No. Abstract classes do not have to contain abstract methods. If a class does, it must be abstract. But not the other way round. Just look at class Math.
But really, use the search function.