Isakaza kuhlelo lwe-ABAP

CLASS a1 INCAZELO.
 ISIGABA SOMPHAKATHI.
 IDATHA: inombolo1 UHLOBO i VALUE 100.
 IZINDLELA:m1.
 ENDCLASS.
 UKUSEBENZA KWE-CLASS a1.
 INDLELA m1.
 BHALA: 'a1:',inombolo1.
 INDLELA.
 ENDCLASS.
 I-CLASS b1 INCAZELO IFA OKUSUKA KU-a1.
 ISIGABA SOMPHAKATHI.
 IZINDLELA:m2, m1 UKUCHAZA KABUSHA.
 ENDCLASS.
 UKUSEBENZA KWE-CLASS b1.
 INDLELA m1.
 inombolo1 = inombolo1.
 BHALA: 'b1:',inombolo1.
 INDLELA.
 INDLELA m2.
 BHALA: 'M2 ekilasini b1'.
 INDLELA.
 ENDCLASS.
 UKUQALA-KOKUKHETHA.
 IDATHA: UHLOBO I-REF TO a1.
 IDATHA: b THLOPHA REF TO b1.
 *idatha: c thayipha REF TO c1.
 ************************************************** ************** DALA INTO b.
 a = b.  "iphakamisa INDLELA YOKUKHONA a->m1( ).
 *shayela INDLELA a->m2( ).  "Asikwazi ukufinyelela izindlela ze-sub class sisebenzisa i-super class ref.
 OKUSHA.
 b?=a.  " ukuphonsa phansi INDLELA YOKUKHONA b->m1( ).
 OKUSHA.
 INDLELA YOKUBIZA b->m2( ).
 ************************************************** *************** " iphutha null ref dala OBJECT a.
 b?=a.  "ukuphonsa phansi kusalokhu kunikezwa ucingo lokulahla elithi METHOD b->m1( ).
 ************************************************** *************** DALA INTO a.
 ZAMA.
 b?=a.  "uzame ukusebenzisa 'NULL' yokulahla ireferensi yento CATCH cx_sy_move_cast_error.
 INDLELA YOKUBIZA b->m1( ).
 ENDTRY.
 ************************************************** *************** DALA INTO a.
 DALA INTO b.
 ZAMA.
 b?=a.
 CATCH cx_sy_move_cast_error.
 INDLELA YOKUBIZA b->m1( ).
 shayela INDLELA b->m2( ).
 ENDTRY.
 CLASS lcl_shape DEFINITION.
 ISIGABA SOMPHAKATHI.
 IZINDLELA ukudweba.
 ENDCLASS.
 CLASS lcl_circle INCAZELO IFA IFA KUSUKA KU-lcl_shape.
 ISIGABA SOMPHAKATHI.
 IZINDLELA: dweba REDEFINITION, calc_area.
 ENDCLASS.
 CLASS lcl_shape IMPLEMENTATION.
 INDLELA dweba.
 BHALA :/ 'Ukudweba noma yisiphi isimo'.
 INDLELA.
 ENDCLASS.
 CLASS lcl_circle IMPLEMENTATION.
 INDLELA dweba.
 BHALA :/ 'Ukudweba umumo othize: Umbuthano'.
 INDLELA.
 INDLELA calc_area.
 BHALA :/ 'Indawo Ye-Crcle = 2iiR'.
 INDLELA.
 ENDCLASS.
 UKUQALA-KOKUKHETHA.
 IDATHA : o_cir TAYIPHA REF TO lcl_circle.
 DALA INTO o_cir.
 INDLELA YOKUSHAYA o_cir->dweba( ).  " ibiza indlela ye-subclass Draw() CALL METHOD o_cir->calc_area( ).
 ULINE.
 "--------- I-Narrow cast(Upcast)----------------" IDATHA : o_shp TYPE REF TO lcl_shape.
 o_shp = o_cir.  " I-Narrow cast(Upcast) CALL INDLELA o_shp->draw( ).  " ibiza indlela yesigaba esincane sika-Draw() "shayela u-METHOD o_shp->calc_area( ) .  " iphutha lokuhlanganiswa kwe-ULINE.
 "---------- Ukusakaza Okunwebekayo(Ukusakaza Okuphansi) -----------" IDATHA : o_cir1 UHLOBO LOKUFIKELELA KU-lcl_circle.
 " o_cir1 = o_shp.  " iphutha lokuhlanganisa o_cir1 ?= o_shp.  " Ukusakaza Okunwebekayo(Okwehliswa) INDLELA YOKUKHONA o_cir1->dweba( ).  " ibiza indlela ye-subclass Draw() CALL INDLELA o_cir1->calc_area( ).
 CLASS a1 INCAZELO.
 ISIGABA SOMPHAKATHI.
 IDATHA: inombolo1 UHLOBO i VALUE 100.
 IZINDLELA:m1.
 ENDCLASS.
 UKUSEBENZA KWE-CLASS a1.
 INDLELA m1.
 BHALA: 'a1:',inombolo1.
 INDLELA.
 ENDCLASS.
 I-CLASS b1 INCAZELO IFA OKUSUKA KU-a1.
 ISIGABA SOMPHAKATHI.
 IZINDLELA:m2, m1 UKUCHAZA KABUSHA.
 ENDCLASS.
 UKUSEBENZA KWE-CLASS b1.
 INDLELA m1.
 inombolo1 = inombolo1.
 BHALA: 'b1:',inombolo1.
 INDLELA.
 INDLELA m2.
 BHALA: 'M2 ekilasini b1'.
 INDLELA.
 ENDCLASS.
 UKUQALA-KOKUKHETHA.
 IDATHA: Umzali UHLOBO I-REF TO a1.
 IDATHA: ingane UHLOBO I-REF TO b1.
 *idatha: c thayipha REF TO c1.
 ************************************************** ************** DALA INTO ngane.
 umzali = ingane.  "ukukhulisa INDLELA YOKUKHONA umzali->m1( ).
 INDLELA YOKUBIZA ingane->m1( ).
 INDLELA YOKUBIZA ingane->m2( ).
 *shayela INDLELA a->m2( ).  "Asikwazi ukufinyelela izindlela ze-sub class sisebenzisa i-super class ref.
 OKUSHA.
 ingane ?= umzali.  " phonsa phansi CALL INDLELA ingane->m1( ).
 OKUSHA.
 INDLELA YOKUBIZA ingane->m2( ).
 ************************************************** **************** *" iphutha null ref *dala OBJECT a.
 *b?=a.  "ukulahla phansi kusalokhu kukhipha ukulahlwa kwayo *call METHOD b->m1( ).
 ************************************************** **************** * DALA INTO a.
 ZAMA.
 b?=a.  "uzame ukusebenzisa 'NULL' yokulahla ireferensi yento CATCH cx_sy_move_cast_error.
 INDLELA YOKUBIZA b->m1( ).
 ENDTRY.
 ************************************************** **************** * DALA INTO a.
 DALA INTO b.
 ZAMA.
 b?=a.
 CATCH cx_sy_move_cast_error.
 INDLELA YOKUBIZA b->m1( ).
 shayela INDLELA b->m2( ).
 ENDTRY.
 ******** Amanani Ayingqayizivele****************** IDATHA : lv_string TYPE string, lv_string2 TYPE string, lv_string_final TYPE string.
 IZINHLOBO: UKUQALA KWE-ty_data, auth TYPE c, END OF ty_data.
 IDATHA: ls_user TYPE ty_data, ls_user2 TYPE ty_data, lt_user2 UHLOBO TABLE OF ty_data, lt_umsebenzisi UHLOBO TABLE OF ty_data.
 lv_string = 'a,b,c,a'.
 lv_string2 = 'd,b,c,a'.
 SPLIT lv_string AT ',' INTO TABLE lt_umsebenzisi.
 SPLIT lv_string2 AT ',' KUTABLE lt_user2.
 LOOP AT lt_user2 ASSIGNING FIELD-SYMBOL( ).
 FAKA KUTHABLE lt_umsebenzisi.
 ENDLOOP.
 HLUNGA lt_umsebenzisi NGEMPELA.
 SUSA IZIMPINDUZO EZIFUMANE KUSUKA KU-lt_user COMPARING auth.
 UMA sy-subrc = 0.
 LOOP AT lt_user ASSIGNING FIELD-SYMBOL( ).
 IF lv_string_final IYOKUQALA.
 lv_string_final = -igunya.
 OKUNYE.
 CONCATENATE lv_string_final -auth INTO lv_string_final IHLUKANISWA YI-','.
 ENDIF.
 ENDLOOP.
 ENDIF.

 

Shiya amazwana

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.