Skip to content

Lesson 8 Practice — Exportable Objects ​

Create:

text
ZIF_EXPORTABLE_###
ZCL_CUSTOMER_EXPORT_###
ZCL_PRODUCT_EXPORT_###
ZCL_ABAP_L08_PRACTICE_###

Interface method:

text
TO_TEXT

returning 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:

  1. Why don't Customer and Product need a common superclass?
  2. What can be called through an interface reference?
  3. Can one class implement multiple interfaces?
  4. Why can an interface reduce coupling?