Abstract class VS Interface

  • A class can implement any number of interfaces but a subclass can at most use only one abstract class.

  • An abstract class can have non-abstract methods (concrete methods) while in case of interface, all the methods have to be abstract.

  • An abstract class can declare or use any variables while an interface is not allowed to do so.

  • In an abstract class, all data members or functions are private by default while in an interface all are public, we can’t change them manually.

  • In an abstract class, we need to use abstract keywords to declare abstract methods, while in an interface we don’t need to use that.

  • An abstract class can’t be used for multiple inheritances while the interface can be used as multiple inheritances.

  • An abstract class uses a constructor while in an interface we don’t have any type of constructor.

Last updated