Sunteți pe pagina 1din 2

OOP is the common abbreviation for Object-Oriented Programming.

eg C++ is Object oriented programming


language...
like that in SAP we are having OO ABAP which stands for Object Oriented ABAP.
METHODS - constructor
Syntax
METHODS constructor [FINAL]
[IMPORTING parameters [PREFERRED PARAMETER p]]
[{RAISING|EXCEPTIONS} exc1 exc2 ...].

Extras:
1. ... IMPORTING parameters
2. ... RAISING exc1 exc2 ...
3. ... EXCEPTIONS exc1 exc2 ...
4. ... FINAL
Effect
: This statement declares the instance constructor constructor of the class. For public and protected instantiatable
classes, this is only possible in the public visibility section of the declaration section of a class. If you use the addition
CREATE PRIVATE in the CLASS DEFINITION statement, this is possible in all visibility sections.
Each class has a predefined method called constructor. By declaring this explicitly, the interface of the method
constructor can be defined specifically for a class, and its functions can be implemented. Without explicit declaration,
the instance constructor assumes the parameter interface of the direct superclass, and calls it implicitly.
If the instance constructor is implemented in a subclass, the instance constructor of the superclass must be called
explicitly using the pseudo reference super->constructor, even if the latter is not explicitly declared. Exceptions to this
are direct subclasses of the root node object. Before the superclass contructor is called, an instance constructor only
has access to the static components of its class. After the superclass constructor is called, it can also access instance
components.
For each instance of a class, the instance constructor is called only once using the statement CREATE OBJECT
immediately after it has been generated. For the call, appropriate actual parameters must be assigned to all nonoptional input parameters, return values can be assigned to non-class-based exceptions, and class-based exceptions
can be declared. It is not possible to call the instance constructor using CALL METHOD, except when calling the
superclass constructors using super->constructor in the redefined constructor of a subclass.
During execution of an instance constructor, the current instance temporarily assumes the type of the class in which
the constructor is defined. This has the following consequences:

If methods are called during the execution of a superclass constructor, the implementations of the superclass are
executed and not the redefinitions of subclasses. The specification of me->, for addressing a redefined method in a
subclass that has just been generated, has no effect.
During execution of a superclass constructor, attempts to access components of the subclass using a Down Cast
lead to a runtime error.

S-ar putea să vă placă și