ABAP调用方法:'static'和'dynamic'的含义
ABAP CALL METHOD: meaning of 'static' and 'dynamic'
我对术语 'static' 和 'dynamic' w.r.t 的含义有点困惑。 ABAP 中的调用方法。
一方面,静态指的是 class 的组件,无需实例即可访问。动态是指在运行时通过字段内容进行访问。
那么,(class)=>(meth)
会是对静态方法的动态调用吗?!
那么反项是什么?
one meaning of dynamic is: (meth_name)
meth_name expects a character-like field that must contain the name of a method when the statement is executed. Consequently, oref->meth
is a static method call
可以使用名称 class=>comp
访问 class 的 static component comp。这里,一个组件可以是一个方法
静态有两种含义:
class 的方法(和属性)是 static
或 instance
。在后一种情况下,class 的实例必须存在,才能调用 class 的实例方法或访问和实例属性。语法不同:
调用实例方法:oref->method
调用一个静态方法:class=>method
与属性类似:
静态:class=>attribute
实例:oref->attribute
另一方面,方法的调用可以是static
或dynamic
。
方法的静态调用:
oref->method
(1) (或 class=>method
(2) )
方法的动态调用:oref->(method)
(3) (or class=>(method)
(4) )
确切地说:
(1)实例方法的静态调用
(2)静态方法的静态调用
(3) 实例方法的动态调用
(4)静态方法的动态调用
我对术语 'static' 和 'dynamic' w.r.t 的含义有点困惑。 ABAP 中的调用方法。
一方面,静态指的是 class 的组件,无需实例即可访问。动态是指在运行时通过字段内容进行访问。
那么,(class)=>(meth)
会是对静态方法的动态调用吗?!
那么反项是什么?
one meaning of dynamic is:
(meth_name)
meth_name expects a character-like field that must contain the name of a method when the statement is executed. Consequently,oref->meth
is a static method call可以使用名称
class=>comp
访问 class 的 static component comp。这里,一个组件可以是一个方法
静态有两种含义:
class 的方法(和属性)是 static
或 instance
。在后一种情况下,class 的实例必须存在,才能调用 class 的实例方法或访问和实例属性。语法不同:
调用实例方法:oref->method
调用一个静态方法:class=>method
与属性类似:
静态:class=>attribute
实例:oref->attribute
另一方面,方法的调用可以是static
或dynamic
。
方法的静态调用:
oref->method
(1) (或 class=>method
(2) )
方法的动态调用:oref->(method)
(3) (or class=>(method)
(4) )
确切地说:
(1)实例方法的静态调用
(2)静态方法的静态调用
(3) 实例方法的动态调用
(4)静态方法的动态调用