‎2007 Jun 29 9:15 AM
HI,
I HAVE 2 CLASS <b> A</b> AND <b>B</b> . NOW I WANT CREATE A CLASS <b>IC</b> WHICH IS INHERITENCE OF BOTH A AND B .
HOW CAN DECLARE IT ?
THANK YOU
ASHOK KUMAR
‎2007 Jun 29 9:19 AM
Hi,
IN ABAP inherting from TWO classes is not possible.
What you can do convert one class to an interface and move the method implementation to the class 'C'.
Then Class C can implement interface 'A" and inherit class 'B'.
Regards,
Sesh
‎2007 Jun 29 9:19 AM
Hi,
IN ABAP inherting from TWO classes is not possible.
What you can do convert one class to an interface and move the method implementation to the class 'C'.
Then Class C can implement interface 'A" and inherit class 'B'.
Regards,
Sesh
‎2007 Jun 29 9:20 AM
Hi,
here is an example to inherite one class.see this.
REPORT demo_inheritance.
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS: set IMPORTING value(set_value) TYPE i,
increment,
get EXPORTING value(get_value) TYPE i.
PROTECTED SECTION .
DATA count TYPE i.
ENDCLASS.
CLASS counter IMPLEMENTATION.
METHOD set.
count = set_value.
ENDMETHOD.
METHOD increment.
ADD 1 TO count.
ENDMETHOD.
METHOD get.
get_value = count.
ENDMETHOD.
ENDCLASS.
CLASS counter_ten DEFINITION INHERITING FROM counter.
PUBLIC SECTION.
METHODS increment REDEFINITION .
DATA count_ten.
ENDCLASS.
CLASS counter_ten IMPLEMENTATION.
METHOD increment.
DATA modulo TYPE I.
CALL METHOD super->increment .
write / count.
modulo = count mod 10.
IF modulo = 0.
count_ten = count_ten + 1.
write count_ten.
ENDIF.
ENDMETHOD.
ENDCLASS.
DATA: count TYPE REF TO counter,
number TYPE i VALUE 5.
START-OF-SELECTION.
CREATE OBJECT count TYPE counter_ten .
CALL METHOD count->set EXPORTING set_value = number.
DO 20 TIMES.
CALL METHOD count->increment.
ENDDO.
rgds,
bharat.
‎2007 Jun 29 9:43 AM
Hi,
please check out the following link it might be helpful to you
http://java.sun.com/docs/books/tutorial/java/concepts/inheritance.html
********please reward points if the information is helpful to you**************
‎2007 Jun 29 9:46 AM
SAP decided that multiple inheritance was not needed. Worse, they also decided that overloading was not needed.
You don't say much about your case in question. Perhaps you can solve it by using interfaces. A class can implement multiple interfaces as you probably already know.