Yin wasan kwaikwayo a cikin Shirin ABAP

MA'ANAR CLASS A1.
 SASHEN JAMA'A.
 DATA: lamba 1 TYPE da VALUE 100.
 HANYOYI: m1.
 KARSHEN CLASS.
 CLASS A1 AIKATA.
 HANYA m1.
 RUBUTA: 'a1:', lamba1.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 CLASS b1 BAYANIN GADO DAGA A1.
 SASHEN JAMA'A.
 HANYOYI: m2, m1 SABBIN.
 KARSHEN CLASS.
 CLASS b1 AIKATA.
 HANYA m1.
 lamba 1 = lamba 1.
 RUBUTA: 'b1:', lamba1.
 KARSHEN MAGANA.
 HANYA m2.
 RUBUTA: 'M2 a cikin aji b1'.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 FARA-ZABI.
 DATA: NAU'IN REF ZUWA a1.
 DATA: b NAU'IN REF ZUWA b1.
 *bayanai: c rubuta REF TO c1.
 *********************************** *************** KIRKIRI ABUBUWA b.
 a = b.  "Tsarin KIRA mai haɓakawa a->m1( ).
 *kira METHOD a->m2( ).  "Ba za mu iya samun damar hanyoyin sub class ta amfani da super class ref.
 SABON LAYI.
 b?= a.  " HANYAR YIN KIRAN saukar da ƙasa b->m1( ).
 SABON LAYI.
 HANYAR KIRA b->m2( ).
 *************************************** *************** " Kuskure null ref ƙirƙirar ABUBUWA a.
 b?= a.  "ƙasa jifa har yanzu da bada juji kira METHOD b->m1( ).
 *********************************** *************** KIRKIRI ABUBUWA a.
 GWADA.
 b?= a.  "Un yi ƙoƙarin yin amfani da jujjuya abubuwan 'NULL' CATCH cx_sy_move_cast_error.
 HANYAR KIRA b->m1( ).
 KARSHEN.
 *********************************** *************** KIRKIRI ABUBUWA a.
 Ƙirƙiri ABUBUWA b.
 GWADA.
 b?= a.
 CATCH cx_sy_move_cast_error.
 HANYAR KIRA b->m1( ).
 kira METHOD b->m2( ).
 KARSHEN.
 CLASS lcl_siffar DEFNITION.
 SASHEN JAMA'A.
 HANYOYIN zana.
 KARSHEN CLASS.
 CLASS CLASS BAYANIN GADO DAGA lcl_siffar.
 SASHEN JAMA'A.
 HANYOYI: zana REDEFINITION, calc_ area.
 KARSHEN CLASS.
 CLASS lcl_siffa IMPLEMENTATION.
 HANYA zana.
 RUBUTA:/ 'Zana kowane Siffa'.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 CLASS lcl_circle IMPLEMENTATION.
 HANYA zana.
 RUBUTA:/ 'Zana takamaiman siffa: Circle'.
 KARSHEN MAGANA.
 METHOD calc_yanki.
 RUBUTA: / 'Yankin Crcle = 2iiR'.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 FARA-ZABI.
 DATA: o_cir TYPE REF ZUWA lcl_circle.
 Ƙirƙiri ABUBUWA o_cir.
 HANYAR KIRA o_cir-> zana( ).  " kira subclass Zana() Hanyar KIRA METHOD o_cir->calc_area( ).
 ULINE
 "--------- Simintin ƙunci (Upcast)---------------" DATA : o_shp TYPE REF TO lcl_siffar.
 o_shp = o_cir.  " kunkuntar simintin gyare-gyare (Upcast) HANYAR KIRA o_shp-> zana ( ).  "ta hanyar kiran sub class Draw()"kira METHOD o_shp->calc_area( ) .  Kuskuren tattarawa ULINE.
 "---------- Fadada Cast(Downcast) -----------" DATA : o_cir1 NAU'IN REF ZUWA lcl_circle.
 "o_cir1 = o_shp.  " Kuskuren complilation o_cir1 ?= o_shp.  " Fadada Cast(Downcast) HANYAR KIRA o_cir1-> zana ( ).  " kira subclass Zana () Hanyar KIRA METHOD o_cir1->calc_area( ).
 MA'ANAR CLASS A1.
 SASHEN JAMA'A.
 DATA: lamba 1 TYPE da VALUE 100.
 HANYOYI: m1.
 KARSHEN CLASS.
 CLASS A1 AIKATA.
 HANYA m1.
 RUBUTA: 'a1:', lamba1.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 CLASS b1 BAYANIN GADO DAGA A1.
 SASHEN JAMA'A.
 HANYOYI: m2, m1 SABBIN.
 KARSHEN CLASS.
 CLASS b1 AIKATA.
 HANYA m1.
 lamba 1 = lamba 1.
 RUBUTA: 'b1:', lamba1.
 KARSHEN MAGANA.
 HANYA m2.
 RUBUTA: 'M2 a cikin aji b1'.
 KARSHEN MAGANA.
 KARSHEN CLASS.
 FARA-ZABI.
 DATA: NAUYIN iyaye REF ZUWA a1.
 DATA: NAUYIN yaro REF ZUWA b1.
 *bayanai: c rubuta REF TO c1.
 *********************************** ************** KIRKIRAR ABINDA YARO.
 iyaye = yaro.  "Hanyar KIRA mai haɓakawa->m1( ).
 HANYAR KIRA yaro->m1( ).
 HANYAR KIRA yaro->m2( ).
 *kira METHOD a->m2( ).  "Ba za mu iya samun damar hanyoyin sub class ta amfani da super class ref.
 SABON LAYI.
 yaro?= iyaye.  " saukar da simintin KYAUTA KIRAN yaro->m1( ).
 SABON LAYI.
 HANYAR KIRA yaro->m2( ).
 *********************************** ***************** *" Kuskure null ref * ƙirƙirar ABUBUWA a.
 b?= ba.  " saukar da har yanzu tana ba da juji *kira HANYA b->m1( ).
 *********************************** ***************** * KIRKIRI ABUBUWA a.
 GWADA.
 b?= a.  "Un yi ƙoƙarin yin amfani da jujjuya abubuwan 'NULL' CATCH cx_sy_move_cast_error.
 HANYAR KIRA b->m1( ).
 KARSHEN.
 *********************************** ***************** * KIRKIRI ABUBUWA a.
 Ƙirƙiri ABUBUWA b.
 GWADA.
 b?= a.
 CATCH cx_sy_move_cast_error.
 HANYAR KIRA b->m1( ).
 kira METHOD b->m2( ).
 KARSHEN.
 ***** Dabi'u Na Musamman******************** DATA : lv_string TYPE string, lv_string2 TYPE string, lv_string_final TYPE string.
 NAU'O'I: MAFARKIN ty_data, auth TYPE c, KARSHEN ty_data.
 DATA: ls_user TYPE TYPE ty_data, ls_user2 TYPE ty_data, lt_user2 TYPE TABLE NA ty_data, lt_user TYPE TABLE NA ty_data.
 lv_string = 'a,b,c,a'.
 lv_string2 = 'd,b,c,a'.
 SPLIT lv_string AT ',' SHIGA TABLE lt_user.
 SPLIT lv_string2 AT ',' SHIGA TABLE lt_user2.
 MANUFA AT lt_user2 SANARWA FILIN-alama( ).
 SHIGA SHIGA TABLE lt_user.
 ƘARSHE.
 SORT lt_user BY auth.
 GAME DA KWAFIYA NA ADJACENT DAGA lt_user COMPARING auth.
 Idan sy-subrc = 0.
 SAUKI A lt_user ASSIGNING FIELD-ALAMOMIN( ).
 IDAN lv_string_final YANA FARKO.
 lv_string_final = -autatacce.
 SAURAN.
 CONCATENATE lv_string_final -auth INTO lv_string_final RABA DA ','.
 KARSHE.
 ƘARSHE.
 KARSHE.

 

Bar Tsokaci

Wannan shafin yana amfani da Akismet don rage spam. Koyi yadda aka sarrafa bayanan bayaninka.