功能组与类

时间:2019-03-19 14:14:02

标签: sap abap

在ABAP中,我想知道功能组具有哪些OO属性。

功能组具有封装,因为我可以将全局变量放入功能组中。 函数组中不能实现多态和继承。这是正确的吗?

不同的功能组实例如何?这是完全面向对象的属性,是否可以通过功能组来实现?

1 个答案:

答案 0 :(得分:8)

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.