+ 2

What is the exact difference between abstract class and interface?

30th Apr 2017, 12:54 PM
yashasvi joshi
yashasvi joshi - avatar
4 Respuestas
+ 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.
30th Apr 2017, 1:24 PM
Complex
Complex - avatar
0
what are you saying.???
1st May 2017, 4:21 PM
shobhit
shobhit - avatar
- 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.
30th Apr 2017, 3:28 PM
shobhit
shobhit - avatar
- 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.
30th Apr 2017, 5:22 PM
1of3
1of3 - avatar