IntroductionInterface and Abstraction cannot be instantiated. Abstract class is also like interface until abstract class is implemented. I have explained in detail difference between an interface and abstract class.
- Abstract class requires virtual method for its implementation in common behavior. Interface class does not require it.
- Abstract can’t be instantiated. Interface class also can’t be instantiated.
- Abstract class is idle until we can’t call from the derived class. Interface class also has the same feature it’s not in use until we call it from sub classes.
- Interface class is slower than abstract class. Abstraction class is much faster than interface class.
- Interface class requires its implementation in sub classes so when we make any changes in interface class we have to track down all implantation & carefully we have to make changes in the classes otherwise compiler will throw error. Abstraction class has default implementation so it does not require tracking down all classes correspondingly.
- Fields & constants cannot be defined in interface class. In abstraction class we can define constants & fields.
- An interface class cannot have access modifiers subs, functions; methods have by default public access modifiers.
- An interface class has not provided any code only can just provide signatures. Abstraction class has the ability to provide the implementation and have also the ability to override its methods, functions etc.
- An interface class can be implemented when units of functions are small. Abstraction class can be implemented when units of functions are very big. This implementation application becomes more neat and clean with no complexity of code.