ABAP OO笔记1

2008-9-1

1.       Procedural Programming:

a)         Functions are defined independently of data structures

b)         Direct access to data

2.       ABAP Objects only allows single inheritance.

3.       ABAP Objects is an extension of ABAP.

4.       All enhancements are strictly upward compatible.

5.       ABAP Objects events are not represented in class diagrams.

6.       The CLASS statement cannot be nested, that is, you cannot define a class within a class.

7.       A class’s attributes can TYPE REF TO (References to objects/interfaces).

8.       In classes, you can only use the TYPE reference to refer to data types in the ABAP Dictionary. You can only use the like reference for local data objects.

9.       The READ-ONLY addition means that a public attribute declared with DATA can be read from outside, but can only be changed by methods within the class.

10.   Instance attribute

a)         One per instance

b)         Statement: DATA

11.   Static attributes:

a)         Only one per class

b)         Statement: CLASS-DATA

c)         Also known as class attributes

12.   In ABAP Objects, methods can have IMPORTING, EXPORTING, CHANGING and RETURNING parameters as well as EXCEPTIONS. All parameters can be passed by value or reference. You can define a return code for methods using RETURNING. You can only do this for a single parameter, which additionally must be passed as a value. Also, you cannot then define EXPORTING and CHANGING parameters. You can define functional methods using the RETURNING parameter (explained in more detail below).

All input parameters (IMPORTING, CHANGING parameters) can be defined as optional parameters in the declaration using the OPTIONSAL or DEFAUL additions. These parameters then do not necessarily have to be passed when the object is called. If you use the OPTIONAL addition, the parameter remains initialized according to type, whereas the DEFAULT addition allows you enter a start value.

13.   Instance methods:

a)         Can use both static and instance components in the implementation part

b)         <reference>-><instance_attribute>

14.   Static methods:

a)         Can only use static components in the implementation part

b)         <classname>=><class_attribute>

c)         CLASS-METHODS

15.   Objects can only be created and addressed using reference variables.

16.   When created independent, they point single. But such as object1 = obejct2 shows that object1 points to the same object as reference object2.

17.   Independent references are references that have not been defined within a class.

18.   Assigning References:

a)        

 

Data: airplane      type ref to cl_airplane,

 airplane_table type table of ref to cl_airplane.

 

                   Create object airplane.

                   Append airplane to airplane_table.

                   Create object airplane.

table

                   Append airplane to airplane_table.

 

19.   Use object table

Loop at to airplane_table into airplane.

* Work with the current instance

Endloop.

20.   If a class defines object references to a second class as attributes, then only these object references will be stored in the objects belonging to that class. The objects in the second class have their own identity.

21.   If you are calling a static method from within the class, you can omit the class name. When calling an instance method from within another instance method, you can omit the instance name. The method is automatically executed for the current object.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值