Abstract Class vs Interface in SAP ABAP.

Mayank Chourasia
2 min readJun 19, 2023

--

In this blog I will explain difference between Abstract class and Interface class.

What is an Abstract Class?

Abstract class cannot be instantiated itself, meaning it will not execute abstract class itself but it can be executed from inherited classes. In Abstract class should contain at least one abstract method. Abstract Method does not have an implementation only a declaration part.

The main advantage of Abstract class is when we need common functionalities. Abstract class can be used as Super class which common functionalities can be used in inherited child classes.

What are an Interfaces?

Interface is not a class. We can implement the methods of interface in the derived class. Interface definition contains only declaration of all components which are attributes, methods, events of the interface. Interface components are always public.F

Some points which can help.

  1. Is it achievable to create Multiple Inheritance?
  • Yes, it is achievable. We can use Interface for implementation.

2. Does ABAP support more than one Super class?

  • No, as can have only one abstract class as Super class.

3. If we want to provide common, implemented functionality among all implementations of your component which class can be used.

  • Abstract classes allow us to partially implement our class

4. Visibility of an abstract class in always set as a private?

  • No we can set the visibility of each component.

Thanks for reading.

If you Want to Connect with Me:

LinkedIn: https://www.linkedin.com/in/mayank-chourasia/

Twitter: https://twitter.com/ChourasiaMayank.

YouTube: Learn Technology with Mayank Chourasia

Thank you, stay safe, and stay healthy.

Stay tuned till the next blog.

--

--

Mayank Chourasia
Mayank Chourasia

Written by Mayank Chourasia

Hey, My name is Mayank Chourasia. Currently I am working on SAP Utilities as a SAP ABAP Developer. I had written a blogs on SAP ISU, SAP ABAP, Google Cloud .

No responses yet