具体创建类:
*Now we can define the concrete creator
class ny definition inheriting from pizzastore.
protected section.
methods:
createpizza redefinition.
endclass.
class ny implementation.
method createpizza.
case pz_name2.
when 'cheese'.
create object pz type nystylepizza1.
when 'vegie'.
when 'clam'.
when 'pepperoni'.
endcase.
endmethod.
endclass.
class chi definition inheriting from pizzastore.
protected section.
methods:
createpizza redefinition.
endclass.
class chi implementation.
method createpizza.
case pz_name2.
when 'cheese'.
create object pz type chistylepizza1.
when 'vegie'.
when 'clam'.
when 'pepperoni'.
endcase.
endmethod.
endclass.
class ny definition inheriting from pizzastore.
protected section.
methods:
createpizza redefinition.
endclass.
class ny implementation.
method createpizza.
case pz_name2.
when 'cheese'.
create object pz type nystylepizza1.
when 'vegie'.
when 'clam'.
when 'pepperoni'.
endcase.
endmethod.
endclass.
class chi definition inheriting from pizzastore.
protected section.
methods:
createpizza redefinition.
endclass.
class chi implementation.
method createpizza.
case pz_name2.
when 'cheese'.
create object pz type chistylepizza1.
when 'vegie'.
when 'clam'.
when 'pepperoni'.
endcase.
endmethod.
endclass.