ABAP OO笔记2
来源:互联网 发布:mac os x 更新失败 编辑:程序博客网 时间:2024/06/10 17:32
2008-9-2
22. Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters, but has many (or as few) IMPORTING parameters and EXCEPTIONS as required.
23. Functional methods can be used directly in various expressions.
24. Methods: tempa
Importing a type ty_distance
Returning b type ty_fuel.
The syntax for instance methods (analogous to static methods) is as follows, depending on the number of IMPORTING parameters:
No IMPORTING parameter: ref->tempa()
Exactly 1 IMPORTING parameter: ref->tempa( p1 ) or ref->tempa( a = p1 )
Several IMPORTING parameters: ref->tempa( a1 = p1 a2 = p2 )
25. Constructor
The constructor is a special (instance) method in a class and is always named CONSTRUCTOR. The following rules apply:
a) Each class has exactly one constructor
b) The constructor does not need to be defined if no implementation is defined.
c) The constructor is automatically called during runtime within the CREATE OBJECT statement.
d) If you need to implement the constructor, then you must define and implement it in the PUBLIC SECTION. When EXCEPTIONS are triggered in the constructor, instances are not created, so no main memory space is taken up.
e) Only has IMPORTING parameters and EXCEPTIONS.
f) Is executed exactly once per instance.
g) Most used to initialize and modify static attributes.
26. Static Constructor
The static constructor is a special static method in a class and is always named CLASS_CONSTRUCTOR. It is executed precisely once per program. The static constructor of class <classname> is called automatically before the class is first accessed, that is, before any of the following actions are executed:
a) Creating an instance in the class using CREATE OBJECT obj, where obj has the data type REF TO <classname>.
b) Addressing a static attribute using <classname>=><an_attribute>.
c) Calling a static attribute using CALL_METHOD <classname>=><a_classmethod>.
d) Registering a static event handler method using SET HANDLER <classname>=><handler_method> for obj.
e) Registering an event handler method for a static event in class <classname>.
f) Automatically called before the class is first accessed.
27. In delegation, two objects are involved in handling a request: then recipient of the reques delegates the execution of the request to a delegate.
28. There is a local namespace within methods. Definitions of variables can cover components in one class.
29. You can address the object itself within object methods using the implicitly available reference variable ME.
For example:
In the CONSTRUCTOR, then instance attribute name is covered by the locally defined variable name. in order to still be able to address the instance attribute, you need to use ME.
- ABAP OO笔记2
- ABAP OO笔记1
- ABAP OO [2] - Strtic attribute
- 【ABAP】ABAP OO使用总结
- ABAP OO Control
- ABAP OO的基本概念
- ABAP OO INHERITANCE & POLYMORPHISM
- ABAP OO EXCEPTION
- ABAP OO EMAIL
- ABAP OO小例子
- ABAP OO编程(一)
- ABAP OO(二)
- ABAP OO(三)
- abap oo 语法
- SAP ABAP OO Event
- ABAP(Object Orientation) OO
- abap oo alv
- Abap OO and .Net OO [1]
- http://www.blogjava.net/sterning/
- ASP.NET中常用的26个优化性能方法
- 网站图像防盗----Apache配置妙法
- hibernate3学习笔记(四)|增删改查
- sql表关于列转行的做法
- ABAP OO笔记2
- java 各种远程通信技术
- 初次体验程序员的辛酸
- 冷笑话更新ing……
- VS2005,c++无法解析的外部符号分析
- CPoint,CSize,CRect类的资料
- ADHELPER类
- 使用JavaMail实现收发电子邮件功能
- 客服SOA实践关键是建立共享业务模块