+ 1

What is the difference between an abstract class and an interface?

20th Aug 2017, 12:57 AM
Alexik
Alexik - avatar
2 Answers
+ 2
Abstract class should at least contain one abstract method and then it can inherited to initialise. on the other hand interface is not a class, an interface is just an interface made up of only abstract methods, here you don't need to define keyword abstract explicitly.
20th Aug 2017, 1:46 AM
shobhit
shobhit - avatar
+ 2
There are quite a few differences between them, but most importantly An abstract class is a class that is only partially implemented by the programmer and it is used to implement the same or different behavior among multiple related objects. and An interface defines a contract that the implementing classes must fulfill. Its definition consists of the signatures of public members, without any implementing code. for more detailed answers check this out: https://stackoverflow.com/questions/1913098/what-is-the-difference-between-an-interface-and-abstract-class
20th Aug 2017, 2:19 AM
Infant Raj
Infant Raj - avatar