What's the difference between interface and abstract class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between interface and abstract class?

abstract class is also consisted of abstract methods too. plz help me get this.

20th Sep 2016, 12:22 AM
문형우
문형우 - avatar
3 Answers
+ 2
A class can only derive from one base class. However, it can derive from multiple interfaces.
30th Sep 2016, 8:28 AM
Crook
Crook - avatar
+ 1
Abstract Class can contain implementation of methods, fields, constructors, etc, while an Interface only contains method and property prototypes. A class can implement multiple interfaces, but it can only inherit one class (abstract or otherwise).
13th Oct 2016, 7:23 AM
pbenikovszky
pbenikovszky - avatar
+ 1
abstract class contains field variables but interface can not contains field variables. abstract class contains constructor but interface can not contain constructor single class can not inherited from multiple abstract classes but single class can inherites multiple interfaces abstract modifier indicates that the thing being modified has missing or incomplete implementation and intetface is completly abstract class which contains only abstract members
13th Oct 2016, 2:25 PM
Vishwanath Patil
Vishwanath Patil - avatar