Inheritance in SAP ABAP
It is an important pillar of OOPS in SAP ABAP which deals with inheriting the property from parents to children. In this, the child class inherits the property of the parent class. The parent class is also known as the Base class or Super class and the child class is known as Derived class or Sub class. The data and methods of the base class are inherited by the derived class. Overwriting of the methods and adding new methods can also be performed by the child class.
Real-life example: – Let’s consider a father and a child. Father’s name is Shekhar and son’s name is Kanu. Shekhar has brown skin, black hair, and grey eyes. Kanu also has grey eyes. So here, Kanu inherited the property of grey eyes from his father. Kanu acts as a derived class and Shekhar acts as a base class.
- Child class: – The class that inherits the property of another class is known as the child/driver/subclass.
- Parent class: – The class whose property is being inherited by another class is known as the Parent class.
SAP ABAP | Understanding Inheritance
As we know there are four pillars of object-oriented programming language. In the same way, SAP ABAP (Advanced Business Application Programming) also has four pillars: Encapsulation, Inheritance, Abstraction, and Polymorphism. In this article, we are going to learn about Inheritance in ABAP, child class, Parent class, and access control. We will also learn about the implementation of inheritance with the help of examples and redefining the methods in subclasses.