When accessing the subclass instance through go_super, what can you do?

Refer to Exhibit.

When accessing the subclass instance through go_super, what can you do? Note: There are 2 correct answers to this question.
A . Access the inherited private components.
B . Access the inherited public components.
C . Call a subclass specific public method
D . Call inherited public redefined methods.

Answer: BD

Explanation:

In object-oriented programming (OOP), particularly in ABAP OOP, when you have a reference to a superclass and you’re working with an instance of a subclass, here’s what you can do:

Access the inherited public components – This is correct. You can always access public components of the superclass through a reference to the superclass, even if the actual object is an instance of a subclass.

Call inherited public redefined methods – This is also correct. If the subclass has redefined a method that was public in the superclass, and you call this method through a reference of the superclass type, the redefined version in the subclass will be executed. This is known as polymorphism.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments