Note : Features is available in Extension (PU8).
Step 1) I have created a class in model A and add a protected method in it.
Step 2) Create a new class in Model B that will be extension of DemoParentCOC class and add below code in it.
You will see here that you are now able to call protected method by using next keyword.
The calling stack will execute in such a way that it will first go to Standard method and finds out if there is any extension method. If it will find out any extension then it will call to it. In extension method again it will try to find out any other extension method. If their is not any second extension method then it will call first standard method logic. After executing logic of standard method COCTest of DemoParentCOC class, it will call remaining code of extension method.
If we did not define NEXT word method else it will not execute standard method.
Step 3) After executing the class, it output will be in this way:
- Info : "COC Started" printed
- Info : "Base class" printed
- Info " "COC ended" printed
No comments:
Post a Comment
Note: only a member of this blog may post a comment.