0% found this document useful (0 votes)
123 views13 pages

Oops Abap Fundamental

The document discusses key concepts in object-oriented programming including classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It defines a class as a user-defined data type that contains attributes, methods, and other components. Objects are instances of classes that have unique identities and attributes. Inheritance allows a class to acquire properties of its parent class, while polymorphism allows methods to behave differently in different classes. Abstraction hides internal details and shows functionality, and encapsulation binds code and data together into a single unit.

Uploaded by

nhavale2206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views13 pages

Oops Abap Fundamental

The document discusses key concepts in object-oriented programming including classes, objects, inheritance, polymorphism, abstraction, and encapsulation. It defines a class as a user-defined data type that contains attributes, methods, and other components. Objects are instances of classes that have unique identities and attributes. Inheritance allows a class to acquire properties of its parent class, while polymorphism allows methods to behave differently in different classes. Abstraction hides internal details and shows functionality, and encapsulation binds code and data together into a single unit.

Uploaded by

nhavale2206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

OOPS CONCEPTS

By Biswajit
Object-Oriented Programming is a methodology or
paradigm to design a program using classes and
objects. It simplifies the software development and
maintenance by providing some concepts:

1. Class
2. Object
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
CLASS

 A class is a user defined data type with attributes,


methods, events, user-defined types, interfaces etc
for a particular entity or business application.
COMPONENTS OF A CLASS

 Attributes: Attributes are variables, constants declared within


a class .
 Methods: Methods are coding blocks which provides some
functionality .
 These methods are similar to Function Modules in ABAP.
 Methods can access all attributes of it`s own class.
 Methods are defined in definition part and implemented in
implementation part.
 We can call methods using CALL METHOD statement.
 Events: Event is a mechanism through which one method of
a class can raise method of other class, without hazard of
instantiating that class.
 Interfaces: Interfaces are similar to classes which contain
methods Without any implementation.
 Interfaces are mainly used to extend the scope or functionality
of the class.
INSTANCE AND STATIC COMPONENTS
 Instance components : These components exist
separately in each instance (object) of the class
and are referred using instance component selector
using ->
 Static components : These components exists
globally for a class and are referred to using static
component selector => .
VISIBILITY OF COMPONENTS OF CLASS
 Public section: Data declared in public section can
be accessed by the class itself, by its subclasses as
well as by other users outside the class.
 Protected section: Data declared in the protected
section can be accessed by the class itself, and
also by its subclasses but not by external users
outside the class.
 Private Section: Data declared in the private
section can be accessed by the class only, but not
by its subclasses and by external users outside the
class.
GLOBAL CLASS AND LOCAL CLASS
 Global Class: Global classes and interfaces are
defined in the Class Builder (Transaction SE24) in
the ABAP Workbench. All of the ABAP programs in
an R/3 System can access the global classes.
 Local Class: Local classes are define in an ABAP
program (Transaction SE38) and can only be used
in the program in which they are defined.
OBJECT

 Objects are nothing but instances of classes, each


object has a unique identity that is memory and it`s
own attributes.

SYNTAX

DATA <instance> TYPE REF TO <class name> .


CREATE OBJECT <instance> .
INHERITANCE

 When one object acquires all the properties and


behaviours of parent object i.e. known as
inheritance. It provides code reusability.
 Inheritance is the concept of passing the behavior
of one class to another class.
 SUPER is the keyword used to represent the super
class in oops, you can access the methods and
attributes the super class using this word super.
 REDIFINATION is the keyword which is used to
overwrite the parent class methods with new
definition.
POLYMORPHISM

 It is a concept by which the same method names


will behave differently in different classes i.e each
method will have its own implementation in different
different classes but with the same name.
 Interface is one of the concept in Object Oriented
ABAP to achieve Polymorphism.
ABSTRACTION

 Hiding internal details and showing


functionality is known as abstraction. For
example: phone call, we don't know the internal
processing.
 In SAP, we use abstract class and interface to
achieve abstraction.
ENCAPSULATION

 Binding (or wrapping) code and data together


into a single unit is known as encapsulation .
 Wrapping up of data into single unit. Or, restriction
on visibility of attributes and methods in the class.
We have 3 levels of visibility:
1. Private
2. Protected
3. Public
THE END

You might also like