Ho kenya lenaneo la ABAP

SEHLOPHA a1 TLHALOSO.
 SECHABA SECHABA.
 DATA: num1 MOFUTA i VALUE 100.
 MEKHOA:m1.
 PHEELLO.
 SEHLOPHA a1 KENYATSO.
 MOKHOA m1.
 NGOLA: 'a1:', palo1.
 PHEELLO.
 PHEELLO.
 SEHLOPHA sa b1 TLHALOSO HO FUMANA HO TSOA HO a1.
 SECHABA SECHABA.
 MEKHOA:m2, m1 TLHALOSO TSOA.
 PHEELLO.
 SEHLOPHA b1 KENYATSO.
 MOKHOA m1.
 palo1 = palo1 .
 NGOLA: 'b1:', palo1.
 PHEELLO.
 MOKHOA m2.
 NGOLA: 'M2 ka tlelaseng b1'.
 PHEELLO.
 PHEELLO.
 QALA-TSA-KHETHA.
 DATA: MOFUTA REF HO A1.
 DATA: b MOFUTA REF HO B1.
 *data: c thaepa REF HO YA c1.
 ************************************************ ************** BOPA SEBAKA b.
 a = b.  "upcasting CALL METHOD a->m1( ).
 *letsa METHOD a->m2( ).  "Ha re khone ho fumana mekhoa ea rona ea li-subclass ref ref.
 MOKHOA O MOCHA.
 b?=a.  " down casting CALL METHOD b->m1( ).
 MOKHOA O MOCHA.
 BITSO MOKHOA b->m2( ).
 ************************************************ *************** " phoso null ref theha OBJECT a.
 b?=a.  "Ho lahlela fatše ho ntse ho fana ka mohala oa ho lahla METHOD b->m1( ).
 ************************************************ *************** BOPA SEHLOOHO a.
 LEKANG.
 b?=a.  "U lekile ho sebelisa ntho ea 'NULL' ho lahla CATCH cx_sy_move_cast_error.
 BITSO MOKHOA b->m1( ).
 PHEELLO.
 ************************************************ *************** BOPA SEHLOOHO a.
 BOPA SEBAKA b.
 LEKANG.
 b?=a.
 CATCH cx_sy_move_cast_error.
 BITSO MOKHOA b->m1( ).
 letsetsa METHOD b->m2( ).
 PHEELLO.
 CLASS lcl_shape TLHALOSO.
 SECHABA SECHABA.
 MEKHOA ho hula.
 PHEELLO.
 CLASS lcl_circle TLHALOSO EA HO FUMANA HO TSOA HO lcl_shape.
 SECHABA SECHABA.
 MEKHOA: taka REDEFINITION, calc_area.
 PHEELLO.
 CLASS lcl_shape IMPLEMENTATION.
 MOKHOA ho hula.
 NGOLA :/ 'Ho taka Sebopeho sefe kapa sefe'.
 PHEELLO.
 PHEELLO.
 CLASS lcl_circle IMPLEMENTATION.
 MOKHOA ho hula.
 NGOLA :/ 'Ho taka sebopeho se itseng: Sedikadikwe'.
 PHEELLO.
 METHOD calc_area.
 NGOLA :/ 'Sebaka sa Crcle = 2iiR'.
 PHEELLO.
 PHEELLO.
 QALA-TSA-KHETHA.
 DATA : o_cir TYPE REF HO lcl_circle.
 BOPA SEBAKA o_cir.
 BITSA METHOD o_cir-> hula( ).  " call subclass Draw() mokhoa CALL METHOD o_cir->calc_area( ).
 ULINE.
 "--------- Narrow cast(Upcast)----------------" DATA : o_shp TYPE REF TO lcl_shape.
 o_shp = o_cir.  " Narrow cast(Upcast) CALL METHOD o_shp->draw( ).  " letsetsa sub class Draw() mokhoa "call METHOD o_shp->calc_area( ) .  " phoso ea ho bokella ULINE.
 "---------- Widening Cast(Downcast) -----------" DATA : o_cir1 MOFUTA REF HO lcl_circle.
 "o_cir1 = o_shp.  " phoso ea ho kopanya o_cir1 ?= o_shp.  " Widening Cast(Downcast) CALL METHOD o_cir1->draw( ).  " letsetsa subclass Draw() mokhoa CALL METHOD o_cir1->calc_area( ).
 SEHLOPHA a1 TLHALOSO.
 SECHABA SECHABA.
 DATA: num1 MOFUTA i VALUE 100.
 MEKHOA:m1.
 PHEELLO.
 SEHLOPHA a1 KENYATSO.
 MOKHOA m1.
 NGOLA: 'a1:', palo1.
 PHEELLO.
 PHEELLO.
 SEHLOPHA sa b1 TLHALOSO HO FUMANA HO TSOA HO a1.
 SECHABA SECHABA.
 MEKHOA:m2, m1 TLHALOSO TSOA.
 PHEELLO.
 SEHLOPHA b1 KENYATSO.
 MOKHOA m1.
 palo1 = palo1 .
 NGOLA: 'b1:', palo1.
 PHEELLO.
 MOKHOA m2.
 NGOLA: 'M2 ka tlelaseng b1'.
 PHEELLO.
 PHEELLO.
 QALA-TSA-KHETHA.
 DATA: motswadi MOFUTA REF HO A1.
 DATA: ngoana MOFUTA REF HO B1.
 *data: c thaepa REF HO YA c1.
 ************************************************ ************** BOPA SEBAKA ngwana.
 motsoali = ngoana.  "upcasting CALL METHOD parent->m1( ).
 BITSA MOKHOA ngoana->m1( ).
 BITSA MOKHOA ngoana->m2( ).
 *letsa METHOD a->m2( ).  "Ha re khone ho fumana mekhoa ea rona ea li-subclass ref ref.
 MOKHOA O MOCHA.
 ngoana?= motsoali.  " down casting CALL METHOD child->m1( ).
 MOKHOA O MOCHA.
 BITSA MOKHOA ngoana->m2( ).
 ************************************************ **************** *" phoso null ref *create OBJECT a.
 *b?=a.  "ho lahlela fatše ho ntse ho fana ka thotobolo *call METHOD b->m1( ).
 ************************************************ **************** * ETSA SEHLOOHO a.
 LEKANG.
 b?=a.  "U lekile ho sebelisa ntho ea 'NULL' ho lahla CATCH cx_sy_move_cast_error.
 BITSO MOKHOA b->m1( ).
 PHEELLO.
 ************************************************ **************** * ETSA SEHLOOHO a.
 BOPA SEBAKA b.
 LEKANG.
 b?=a.
 CATCH cx_sy_move_cast_error.
 BITSO MOKHOA b->m1( ).
 letsetsa METHOD b->m2( ).
 PHEELLO.
 ******** Maemo a Ikhethang****************** DATA : lv_string TYPE string, lv_string2 TYPE string, lv_string_final TYPE khoele.
 MEFUTA: QALA HO ty_data, auth TYPE c, END OF ty_data.
 DATA: ls_user TYPE ty_data, ls_user2 TYPE ty_data, lt_user2 MOFUTA TABLE EA ty_data, lt_mosebedisi MOFUTA TABLE EA ty_data.
 lv_string = 'a,b,c,a'.
 lv_string2 = 'd,b,c,a'.
 SPLIT lv_string AT ',' IN TABLE lt_user.
 SPLIT lv_string2 AT ',' KA TABLE lt_user2.
 LOOP AT lt_user2 ASSIGNING FIELD-SYMBOL( ).
 KENYA HO TABLE lt_mosebedisi.
 PHETHA.
 HLOPHA lt_user BY Auth.
 HLAKOLA ADJACENT DUPLICATES HO lt_user COMPARING auth.
 HAEBA sy-subrc = 0.
 LOOP AT lt_user ASSIGNING FIELD-SYMBOL( ).
 HAEBA lv_string_final KE NTSHA.
 lv_string_final = -boleli.
 TSE LING.
 CONCATENATE lv_string_final -auth HO lv_string_final E AROLOTSWE KE ','.
 QETELA.
 PHETHA.
 QETELA.

 

Leave ka tlhaloso

Sebaka sena se sebelisa Akismet ho fokotsa spam. Ithute kamoo litlhaloso tsa hau li hlahang kateng.