Tuesday, September 25, 2018

Multilevel Inheritance in SAP ABAP?

Multilevel Inheritance:

The class which inherits the properties of another class is called Derived or Child or Sub class and the class whose properties are inherited is called Base or Parent or Super class. 

When a class is derived from a class which is also derived from another class, i.e. a class having more than one parent classes, such inheritance is called Multilevel Inheritance

 The level of inheritance can be extended to any number of level depending upon the relation. Multilevel inheritance is similar to relation between grandfather, father and child.
EXAMPLE :--
  • Student is derived from person and person is derived from class living things.
  • Car is derived from vehicle and vehicle is derived from machine.
CLASS grand_father DEFINITION.
******/ write the code*****

ENDCLASS.
CLASS father DEFINITION INHERITING FROM grand_father.
*******/write the code*********
ENDCLASS.
CLASS son DEFINITION INHERITING FROM father.
*******/write the code ********
ENDCLASS.