Understanding the concepts of Object Oriented Programming

...Previous

Attributes of Object Oriented Programming:

  • Inheritance.

  • Abstraction.

  • Encapsulation.

  • Polymorphism 

Inheritance is the concept of adopting the features from the parent and reusing them . It involves passing the behavior of a class to another class. You can use an existing class to derive a new class. Derived classes inherit the data and methods of the super class. However, they can overwrite existing methods, and also add new ones.

Inheritance is of two types: Single Inheritance and Multiple Inheritance

Single Inheriting: Acquiring the properties from a single parent. (Children can be more).

Example for Single Inheritance

Multiple inheritance: Acquiring the properties from more than one parent.

                 Example                                                 

Syntax : CLASS <subclass> DEFINITION INHERITING FROM <superclass>.

Let us see a very simple example for creating subclass(child) from a superclass(parent)

Multiple Inheritance is not supported by ABAP.        

Output is as follows :

Abstraction: Everything is visualized in terms of classes and objects.

Encapsulation The wrapping up of data and methods into a single unit (called class) is known as Encapsulation. The data is not accessible to the outside world only those methods, which are wrapped in the class, can access it.

Polymorphism: Methods of same name behave differently in different classes. Identical (identically-named) methods behave differently in different classes. Object-oriented programming contains constructions called interfaces. They enable you to address methods with the same name in different objects. Although the form of address is always the same, the implementation of the method is specific to a particular class.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image