REPORT ZOOABAP_CL13.
*class lcl_vehicle DEFINITION final. "cannot be inherited
class lcl_vehicle DEFINITION.
public SECTION.
methods display.
protected SECTION.
data : wheels type i,
brakes type i.
endclass.
class lcl_vehicle IMPLEMENTATION.
method display.
write :/ wheels,brakes.
endmethod.
endclass.
class lcl_cycle DEFINITION INHERITING FROM lcl_vehicle.
PUBLIC SECTION.
methods setcycle.
PROTECTED SECTION.
data color type string.
endclass.
class lcl_cycle IMPLEMENTATION.
method setcycle.
wheels = 2.
brakes = 2.
color = 'Green'.
write :/ 'Color of cycle is ',color.
endmethod.
endclass.
class lcl_bike DEFINITION INHERITING FROM lcl_cycle.
PUBLIC SECTION.
methods setbike.
PROTECTED SECTION.
data gears type i.
endclass.
class lcl_bike IMPLEMENTATION.
method setbike.
wheels = 2.
brakes = 1.
color = 'Red'.
gears = 5.
write :/ 'color of bike :',color,
/ 'Gears in bike :',gears.
endmethod.
endclass.
START-OF-SELECTION.
data ob1 type ref to lcl_cycle.
create object ob1.
format color 3.
call method : ob1->setcycle,
ob1->display.
uline.
format color 7.
data ob2 type ref to lcl_bike.
create object ob2.
call method : ob2->setbike,
ob2->display.
Tuesday, August 11, 2020
Inheritance – Local Classes (Class 14)
-
UPDATE FUNCTION MODULE : The main update technique for bundling database changes in a single database ...
-
INTERACTIVE ALV USING OOABAP (FACTORY METHOD)& EVENTS. They are multiple ways of making a interactive alv using OOABAP ,using contai...