Thursday 12 July 2012

abstract class

Abstract class with constructor and super keyword..






class b1 DEFINITION ABSTRACT.
  PUBLIC SECTION.
  methods:constructor.
  ENDCLASS.

  class b2 DEFINITION INHERITING FROM b1.
   PUBLIC SECTION.
   methods:constructor.
    ENDCLASS.

class b1 IMPLEMENTATION.
  METHOD: constructor.
    write:/ 'constuctor with abstract class'.
    ENDMETHOD.
    ENDCLASS.
    class b2 IMPLEMENTATION.
     METHOD:constructor.
       CALL METHOD super->constructor.

       WRITE :/ 'constructor abstract class and super keyword'.
       ENDMETHOD.
     ENDCLASS.
    START-OF-SELECTION.
    DATA: obj TYPE REF TO b2.
    create OBJECT obj.

No comments:

Post a Comment