CLASS ZCL_OO_TUTORIAL_6_TESTER DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES IF_OO_ADT_CLASSRUN.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.



CLASS ZCL_OO_TUTORIAL_6_TESTER IMPLEMENTATION.


  METHOD IF_OO_ADT_CLASSRUN~MAIN.
    SELECT * FROM /DMO/FLIGHT
        WHERE CARRIER_ID = `UA`
        INTO TABLE @DATA(FLIGHTS).

    LOOP AT FLIGHTS REFERENCE INTO DATA(FLIGHT).
      TRY.
          DATA(FLIGHT_OBJECT) = ZCL_OO_TUTORIAL_6_BASE=>GET_FLIGHT_OBJECT(
            CARRIER_ID = FLIGHT->CARRIER_ID
            CONNECTION_ID = FLIGHT->CONNECTION_ID
            FLIGHT_DATE = FLIGHT->FLIGHT_DATE ).
          OUT->WRITE( FLIGHT_OBJECT->GET_FLIGHT_DETAILS( ) ).
          OUT->WRITE( FLIGHT_OBJECT->CALCULATE_FLIGHT_PRICE( ) ).
          IF FLIGHT->PLANE_TYPE_ID CS ZCL_OO_TUTORIAL_6_BASE=>PLANE_TYPE-B747.
            DATA(FLIGHT_747) = CAST ZCL_OO_TUTORIAL_6_747( FLIGHT_OBJECT ).
            FLIGHT_747->GET_INFLIGHT_MOVIES( ).
            OUT->WRITE( FLIGHT_747->GET_INFLIGHT_MOVIES(  ) ).
          ENDIF.
          OUT->WRITE( ` ` ).
        CATCH ZCX_OO_TUTORIAL INTO DATA(CX_FLIGHT).
          OUT->WRITE(  CX_FLIGHT->GET_TEXT(  ) ).
      ENDTRY.
    ENDLOOP.

    if sy-subrc = 0.
    endif.

  ENDMETHOD.
ENDCLASS.
