You are on page 1of 1

*&---------------------------------------------------------------------*

*& Report ZCONSTRUCTOR1


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZCONSTRUCTOR1.
class STUDENT DEFINITION.

PUBLIC SECTION.
methods constructor IMPORTING name type string
roll_no type i.
methods display_data.
CLASS-METHODS get_branch IMPORTING branch TYPE string.
class-data i_branch type string.
PRIVATE SECTION.
DATA: i_name type string,
i_roll_no type i.

ENDCLASS.
class STUDENT IMPLEMENTATION.

method constructor.
i_name = name.
i_roll_no = roll_no.

ENDMETHOD.

method display_data.
write:'the name of student is',i_name.
write:'the rollno of student is',i_roll_no.
write:'the branch of student is',i_branch.

ENDMETHOD.
method get_branch.
i_branch = branch.
ENDMETHOD.
ENDCLASS.
data: o1 type REF TO student.

START-OF-SELECTION.
CREATE OBJECT o1 EXPORTING name ='jiss'
roll_no = '67'.
o1->display_data( ).

You might also like