0

I face this question in many interviews but here i exactly want to know the big difference between interface and abstract class in object oriented programming.

Anyone there?

shahzad1122
  • 285
  • 1
  • 6
  • 23
  • Possible duplicate of [Interface vs Abstract Class (general OO)](https://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo) – John Kugelman May 17 '18 at 12:51

3 Answers3

0

Interface: 1.Interface is not class 2.Interface use for – Data Abstraction, Future implementation. 3. Interface contains only the abstract members. 4.Interface contains the declaration, the class which will implement it will have to define/add the logic on it.

Abstract Class 1.Abstract class is a class 2.Abstract class is use for a base class. 3. Abstract class contains both Abstract + normal members 4.The abstract members have only the declaration (like Interface),but the normal members are getting define.

Ajit
  • 1
0

One major difference of interface and abstract class is:

if interface contains 9 methods and we implements that interface then we need to override all 9 methods in our class.

if we take one abstract class and we extends that abstract class no need to override all 9 methods override only that method that wee need.

123Gaurav
  • 19
  • 1
0

The main difference is that in interface we can only define the methods and variable and give body/values where it is implemented by overriding. Where abstract class has the property of a normal class and an interface. We can just make the variables and methods abstract like interface and we can also add variables and methods with body/value in the same class.

kamran186
  • 111
  • 1
  • 5