SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

What is OOPS (Object Oriented Programming)

What is OOPS (Object Oriented Programming)

Object-oriented programming is an approach that provides a way of modularizing programs by creating a memory area for both data and function that can be used as templates for creating copies of such modules on demand.

The main objective of OOP is to model real world entity, each real world entity can be modelled by its characteristics and functionality .The real world entity when modelled into OOP world is known as Class, characteristics as attributes and functionality as methods.
A class has two parts definition part and implementation part. In the definition part the definition of the class components as well as visibility of components is done. And in the implementation usually the method implementation is done.

Objects are instance of a Class or in other words they are run time entities, in an object-oriented system.


Components of Class

As we know Class is a modelled real world entity it must have some characteristics as well as functionality .The characteristics are known as attributes in OOP terminology, they are basically different data types.
The functionality is known as methods and events, methods and events reflect the capabilities of a class. Methods are functions which can be called by the instance of a class (i.e. objects) where as events are called automatically when certain sets of conditions (for
that particular event are fulfilled).
Other possible components can be interface, structure internal table etc.


Component Visibility

This is one of the most important concepts of OOP, here we provided with the flexibility to assign visibility of the class components. But before we proceed any further lets clear the fact what do we mean by visibility of class components?
The components of a class can only be accessed through the objects but declaring the class components in different domains, which are defined as Public Private and Protected, these domains control the accessibility.


Public components of a class can be accessed by the objects of a class components in the public domain are totally visible outside the class other components within the class can also access them.
Private components cannot be accessed by the objects of the class they can only be accessed by the members within the class i.e. any member function within the class can access the private members thus from the point of visibility no private components are visible outside

The sequence of declaring the components are public protected and private.

Add comment

Before Buying, Compare Prices at