抽象产品类:
*----------------------------------------------------------------------*
* INCLUDE ZBOBO_DP_004_IF_CL *
*----------------------------------------------------------------------*
*Declare product class
class pizza definition abstract.
public section.
* Define instance variants
data:
name type string,
dough type string,
sauce type string.
data:
begin of rtab,
str type string,
end of rtab,
itab like table of rtab.
* Methods which will be inherited by subclass
methods:
* Prepare pizza
prepare,
* Bake pizza
bake,
* Cut pizza
cut,
* Boxing pizza
box,
* Getter method to get pizza name
getname
returning value(na) type string.
endclass.
*Implement the pizza class
class pizza implementation.
method prepare.
write:
/ 'Preparing:', name,
/ 'Tossing dough....',
/ 'Adding sauce....',
/ 'Adding toppings:'.
loop at itab into rtab.
write: / rtab-str.
endloop.
endmethod.
method bake.
write: / 'Bake for 25 minutes at 350'.
endmethod.
method cut.
write: / 'Cutting the pizza into diagonal slices'.
endmethod.
method box.
write: / 'place pizza in official PizzaStore box'.
endmethod.
method getname.
na = name.
endmethod.
endclass.
* INCLUDE ZBOBO_DP_004_IF_CL *
*----------------------------------------------------------------------*
*Declare product class
class pizza definition abstract.
public section.
* Define instance variants
data:
name type string,
dough type string,
sauce type string.
data:
begin of rtab,
str type string,
end of rtab,
itab like table of rtab.
* Methods which will be inherited by subclass
methods:
* Prepare pizza
prepare,
* Bake pizza
bake,
* Cut pizza
cut,
* Boxing pizza
box,
* Getter method to get pizza name
getname
returning value(na) type string.
endclass.
*Implement the pizza class
class pizza implementation.
method prepare.
write:
/ 'Preparing:', name,
/ 'Tossing dough....',
/ 'Adding sauce....',
/ 'Adding toppings:'.
loop at itab into rtab.
write: / rtab-str.
endloop.
endmethod.
method bake.
write: / 'Bake for 25 minutes at 350'.
endmethod.
method cut.
write: / 'Cutting the pizza into diagonal slices'.
endmethod.
method box.
write: / 'place pizza in official PizzaStore box'.
endmethod.
method getname.
na = name.
endmethod.
endclass.