Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Reply from robphelan on Jan 12 at 9:47 AM Can't you just create an instance of the parent class and call the method just like you did with the child class?
| | | ---------------Original Message--------------- From: pathakvikash72 Sent: Thursday, January 12, 2017 7:51 AM Subject: How To Call Parent Class Method Using Sub Class Object Hello friends, I have a question in OOPS ABAP, I have two class class_parent and class_child , and child class is inheriting parent class and using same method in child class but different implementation , so i s there a way that we could call parent method from child class object Eg. CLASS CLASS_PARENT DEFINITION. PUBLIC SECTION. DATA: A TYPE I, B TYPE I, C TYPE I. METHODS: DISPLAY. ENDCLASS. CLASS CLASS_PARENT IMPLEMENTATION. METHOD DISPLAY. C = A B. WRITE:/ C. ENDMETHOD. ENDCLASS. CLASS CLASS_CHILD DEFINITION INHERITING FROM CLASS_PARENT. PUBLIC SECTION. DATA: A1 TYPE I, B1 TYPE I, C1 TYPE I. METHODS: DISPLAY REDEFINITION. "REDEFINE THE SUPER CLASS METHOD ENDCLASS. CLASS CLASS_CHILD IMPLEMENTATION. METHOD DISPLAY. C1 = A1 * B1. ENDMETHOD. ENDCLASS. *CREATE THE OBJECT FOR SUB CLASS. DATA: OBJ TYPE REF TO CLASS_CHILD. START-OF-SELECTION. CREATE OBJECT OBJ. CALL METHOD OBJ->DISPLAY. So is there a way that we could access CLASS_PARENT method from object OBJ Thanks in Advance | | Reply to this email to post your response. __.____._ | _.____.__ |