New Year Sale ! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

SAP Exam C_ABAPD_2309 Topic 1 Question 15 Discussion

Actual exam question for SAP's C_ABAPD_2309 exam
Question #: 15
Topic #: 1
[All C_ABAPD_2309 Questions]

In a subclass subl you want to redefine a component of a superclass superl. How do you achieve this? Note: There are 2 correct answers to this question.

Show Suggested Answer Hide Answer
Suggested Answer: A, C

To redefine a component of a superclass in a subclass, you need to do the following12:

You add the clause REDEFINITION to the component declaration in the subclass. This indicates that the component is inherited from the superclass and needs to be reimplemented in the subclass. The redefinition must happen in the same visibility section as the component declaration in the superclass. For example, if the superclass has a public method m1, the subclass must also declare the redefined method m1 as public with the REDEFINITION clause.

You implement the redefined component in the subclass. This means that you provide the new logic or behavior for the component that is specific to the subclass. The redefined component in the subclass will override the original component in the superclass when the subclass object is used. For example, if the superclass has a method m1 that returns 'Hello', the subclass can redefine the method m1 to return 'Hi' instead.

You cannot do any of the following:

You implement the redefined component for a second time in the superclass. This is not possible, because the superclass already has an implementation for the component that is inherited by the subclass. The subclass is responsible for providing the new implementation for the redefined component, not the superclass.

You add the clause REDEFINITION to the component in the superclass. This is not necessary, because the superclass does not need to indicate that the component can be redefined by the subclass. The subclass is the one that needs to indicate that the component is redefined by adding the REDEFINITION clause to the component declaration in the subclass.


Contribute your Thoughts:

Jeanice
6 months ago
No, that seems off. The implementation should be in the subclass for redefinition. So, options A and C should be the answers.
upvoted 0 times
...
Nilsa
6 months ago
Wait, did someone say 'redefined component'? Is this a programming exam or a comedy show?
upvoted 0 times
Carry
5 months ago
B) You implement the redefined component for a second time in superl.
upvoted 0 times
...
Britt
5 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Kanisha
5 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
...
Clare
6 months ago
Doesn’t adding the clause in superl sound like it could be right too?
upvoted 0 times
...
Annabelle
6 months ago
That would be option C. Makes sense to me since the subclass should override the implementation.
upvoted 0 times
...
Lanie
6 months ago
Ah, the classic subclass override. C is the winner here, folks. I'm pretty sure that's how it works.
upvoted 0 times
...
Raelene
6 months ago
D? Really? That doesn't make any sense. You definitely need to redeclare it in the subclass, not the superclass.
upvoted 0 times
...
Veta
6 months ago
Yeah, that's option A. But isn't it also correct to implement the redefined component in subl?
upvoted 0 times
...
Jeanice
6 months ago
I agree, it's tricky. I think adding the clause REDEFINITION to the component in subl is one of the correct answers.
upvoted 0 times
...
Sanjuana
7 months ago
A and C, for sure. Overriding the component in the subclass is the standard approach.
upvoted 0 times
Dahlia
5 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Dahlia
5 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
Mignon
5 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Mignon
5 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
Sheridan
6 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Sheridan
6 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
...
Karina
7 months ago
Option C is the way to go. You simply redefine the component in the subclass subl. Easy peasy!
upvoted 0 times
Bong
6 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Marti
7 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
...
Annabelle
7 months ago
This question about redefining a component in a subclass is quite challenging.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77