BlackFriday 2024! 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 17 Discussion

Actual exam question for SAP's C_ABAPD_2309 exam
Question #: 17
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:

Salome
5 months ago
Wait, is this a trick question? I thought we were supposed to redefine the component, not just implement it. Where's the 'MAKE IT BIGGER' option?
upvoted 0 times
...
Kayleigh
5 months ago
This is a tricky one, but I think the solution is to do both - implement the redefined component in subl and add the REDEFINITION clause to the component in superl. So C and D are the correct answers.
upvoted 0 times
Jaime
5 months ago
Great, so the correct answers are C) You implement the redefined component in subl and D) You add the clause REDEFINITION to the component in superl.
upvoted 0 times
...
Lisha
5 months ago
Yes, that's correct. It's important to do both to properly redefine the component.
upvoted 0 times
...
Merissa
5 months ago
I think you're right, we need to implement the redefined component in subl and add the REDEFINITION clause to the component in superl.
upvoted 0 times
...
...
Shaunna
5 months ago
Definitely options C and A are the right answers. You need to implement the redefined component in subl, and also add the REDEFINITION clause to the component in subl.
upvoted 0 times
...
Melda
6 months ago
Hmm, I'm not sure about that. Doesn't the REDEFINITION clause need to be added to the superclass component as well? I'd say options C and D are both correct.
upvoted 0 times
Shawn
4 months ago
User 2
upvoted 0 times
...
Azalee
4 months ago
User 1
upvoted 0 times
...
Viva
4 months ago
I agree. Option D is also correct. You add the clause REDEFINITION to the component in superl.
upvoted 0 times
...
Tammi
5 months ago
No, I believe option D is correct. You add the clause REDEFINITION to the component in superl.
upvoted 0 times
...
Tammi
5 months ago
I think option C is correct. You implement the redefined component in subl.
upvoted 0 times
...
Alona
5 months ago
I think option C is correct. You implement the redefined component in subl.
upvoted 0 times
...
...
Lonny
6 months ago
I think option C is the correct answer. You need to implement the redefined component in the subclass subl to override the component from the superclass superl.
upvoted 0 times
Paola
5 months ago
C) You implement the redefined component in subl.
upvoted 0 times
...
Frank
6 months ago
A) You add the clause REDEFINITION to the component in subl.
upvoted 0 times
...
...

Save Cancel