Introduction to constructors in ABAP

 Constructors:

        Constructor is a special type of method which is executed automatically when an object is created.

        * Constructor cannot be called using CALL METHOD.

        * Constructors are methods with a predefined name.

        * Multiple CONSTRUCTOR and CLASS_CONSTRUCTOR are not allowed with in a class.

 
Types of constructors:

* There are two types of constructors.
* Instance constructor.
    - Method name - CONSTRUCTORS.
    - It has only imported parameters.
    - It can access both instance and static attributes.
    - It is called every time when object is created.
* Static constructor.
    - Method name - CLASS_CONSTRUCTORS.
    - It does not have any parameters.
    It can access static attributes.
    - It is called first time when an object is created.

****************************Thank you ****************************


Comments

Popular posts from this blog

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).

Concatenation new syntax( 7.4+ ).