Appearance
Lesson 8 Practice — Exportable Objects
Create:
text
ZIF_EXPORTABLE_###
ZCL_CUSTOMER_EXPORT_###
ZCL_PRODUCT_EXPORT_###
ZCL_ABAP_L08_PRACTICE_###Interface method:
text
TO_TEXTreturning string.
Both unrelated classes implement the interface differently.
Create a standard table of REF TO ZIF_EXPORTABLE_###.
Append several Customer and Product objects.
Loop once and print TO_TEXT for every object.
Optional: add ZIF_VALIDATABLE_### returning abap_bool and let one class implement both interfaces.
Questions:
- Why don't Customer and Product need a common superclass?
- What can be called through an interface reference?
- Can one class implement multiple interfaces?
- Why can an interface reduce coupling?