David
David

Reputation: 3046

Function Groups vs Classes

In ABAP I want to know which OO-Properties a function group has.

A function group has encapsulation, because I can put in global variables in a function group. Polymorphism and Inheritance are not possible within a function group. Is this correct?

What about different instances of function groups? Is this an OO-Property at all and is it possible to accomplish this with function groups?

Upvotes: 1

Views: 1953

Answers (1)

Florian
Florian

Reputation: 5071

As described in Clean ABAP:

  • No instantiation. You cannot create multiple instances of the same function group.
  • No inheritance. You cannot inherit from or let inherit function groups.
  • No interfaces. You cannot provide two implementations for the same function group.
  • No substitution. You cannot exchange a call to one function with a call to another one with different name but identical signature.
  • No overloading. You cannot provide two functions with identical names but different parameters. (This is not possible in ABAP OO too, by the way.)
  • Variable encapsulation. Function groups can hide internal state in private variables.
  • Method encapsulation. Function groups can hide internal methods ("form routines").

Like Jagger and Sandra Rossi suggest, think of a function group as a global abstract final class with static public/private members.

Upvotes: 9

Related Questions