cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OOABAP

128
Explorer
3,432

Hello everyone, please help me with the following question:

You have a superclass super1 and a subclass sub1 of super1. Each class has an instance constructor and a static constructor. The first statement of the program created an instance of sub1. In which sequence will the constructors be executed?

a. Class constructor of super1

b. Instance constructor of sub1

c. Instance constructor of super 1

d. Class constructor of sub1.

Accepted Solutions (1)

Accepted Solutions (1)

Sijin_Chandran
Active Contributor

Hello,

The right sequence is:

1.) Static Constructor of super1.

2.) Static Constructor of sub1.

3.) Instance Constructor of sub1

4.) Instance Constructor of super1 finally!

Refer the below SAP link for better understanding,

https://learning.sap.com/learning-journeys/acquire-core-abap-skills/implementing-inheritance_bfdb59f...

Thanks,

Sijin

Sandra_Rossi
Active Contributor

Aligned to the OP question, the exact answer would be {a, d, b, c} :

a. Class constructor of super1

d. Class constructor of sub1.

b. Instance constructor of sub1

c. Instance constructor of super 1

 

Sijin_Chandran
Active Contributor
0 Kudos
Yeah with 'Static Constructor' I meant CLASS_CONSTRUCTOR only, just aligned the name as per Standard SAP document 🙂

Answers (1)

Answers (1)

Soumya_Roy19
Newcomer
0 Kudos

17587219360718291434417639389349.jpg

 correct options