You are on page 1of 2

Inheritance - A CLASS shares its structure & behaviour with another class

Polymorphism - Objects that are different from one another but use the same communication
interface
Events - Objects respond & triggers events
CLASS
Defines the structure and functionality of an Object.
ATTRIBUTES - Defines the data the Object will contain
Methods - Defines the functionality of the Object
When we define a class we define:
Definition - We declare the attributes & Method Interfaces
Implementation - Definition of the Methods
CLASS
CLASS myclass DEFINITION.
.....
ENDCLASS.
CLASS myclass IMPLEMENTATION.
.....
ENDCLASS.
We must have both DEFINITION & IMPLEMENTATION
When we create a CLASS no object is created.We are just defining the BLUEPRINT for what
objects based on this class contain and do.
Classes can be defined locally or Globally(using SE24 - Class Builder)
Object - An instance of a class. We instantiate an object based on the blueprint.
Allows us to store data and/or allow method execution
A class definition can define the following:
types, constants, data objects(attributes), and method interfaces.
We can choose how we define the visibility of attributes
Public - available from outside the object.
Private - available only within the object itself.
Protected A Public attribute may be designated as READ-ONLY.
A READ-ONLY attribute only really makes sense in a PUBLIC SECTION.
STATIC Attributes
A Static attribute is a shared attribute across all objects based on a class.
It is not dependant on instantiation of each object. This means we can access a static
attribute without creating an object.
All of the objects in a class have access to static attributes
Declare them using the CLASS-DATA statement.
Changing the value of a static attribute will make the changed value visible in all other objects

created from that class.


METHODS
Class definition - the method definition indicates a method's
Interface:
Method parameters
Method return type (method signature)
Method exception
Methods may be designated as public or private.
A private method may only be called from within another method of the class.
Just as we have class-data(static attributes) we can have CLASS-METHODS too.
These methods may only access static attributes.
Class methods may be invoked either using the name of the class or on an object of the class.
An object does not need to be instantiated to invoke a class Method.
METHODS - Parameter Types
IMPORTING - Used to transfer data INTO a method.
Can be designated as OPTIONAL and can have a DEFAULT value specified.
The VALUE of a parameter can not be changed in the method definition.
EXPORTING - Used to transfer data OUT of a method.
At the end of the method the value of the EXPORTING parameter(s) will be passed back to the
calling program.
CHANGING- A mix of IMPORTING & EXPORTING.
Passed into the method for use and Can be changed.
Can be designated as OPTIONAL and can have a DEFAULT value specified.
Exported back out to the calling progarm at the end of the method.
You can use pass by value as well as the default passs by reference.
FUNCTIONAL METHODS
If you want your method to return a single value, you can create a Functional Method.
Use RETURNING in the methods interface.
When using RETURNING, the EXPORTING & CHANGING parameters can not be used.
TO RETURN the value, you assing the value to the name of the data object identified in the
RETURNING statement.
You do not use a RETURN statement.
This gives us the ability to create Methods that can be called within other statements such as
IF,CASE,MOVE and
COMPUTE.

You might also like