Sie sind auf Seite 1von 2

1. METHODS a) They can access all the attributes of a class. b) Methods have parameters (Signature).

c) IMPORTING, EXPORTING, CHANGING, RETURNING, EXCEPTIONS, RAISING d) Syntax: IMPORTING var Type type, RETURNING VALUE (var) TYPE type, EXCEPTIONS exception RAISING class exception e) Public Methods can be called from anywhere; Private Methods can be called only within the class. f) Instance Methods can use both static and instance attributes and can be called using an instance. They are called using CALL METHOD refvar->instancemethod. You can access instance attributes using <instance>-><instance_attribute>. g) Static Methods also called as class methods can only use static components and can be called using a class. They are called using CALL METHOD classname => classmethod. If you are calling a static method from within the class, you can omit the class name. You can access static attributes using <classname>=><class_attribute> h) => and -> are the component selectors. i) Functional Methods: 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. You can only do this for a single parameter, which additionally must be passed as a value. 2. Reference variable: A reference variable act as a pointer to an object. DATA: lv_vehicle TYPE REF TO lcl_vehicle. 3. Creating Objects: we can create multiple objects. Syntax Create Object lcl_vehicle. Gt_itab Type Table of REF TO lcl_vehicle. 4. The Garbage Collector is a system routine that automatically deletes objects that can no longer be addressed from the main memory and releases the memory space they occupied. 5. Constructor: The constructor is a special instance method in a class with the name constructor. a) Each class can have one constructor and is executed only once per instance. b) The constructor is automatically called at runtime within the CREATE OBJECT statement. c) If you need to implement the constructor, then you must define and implement it in the PUBLIC SECTION. You cannot normally call the constructor explicitly. d) Used for creating objects with defined initial state. e) Only has IMPORTING and EXCEPTIONS parameters. f) Static Constructor: The static constructor is a special static method in a class with the name class_constructor. It is executed precisely once per program. The static constructor cannot be called explicitly.

6. Reference variable ME: 7. Inheritance: Inheritance is a relationship, in which one class (the subclass) inherits all the main characteristics of another class (the superclass). The subclass can also add new components (attributes, methods, and so on) and replace inherited methods with its own implementations. a) ABAP OO has only Single Inheritance. Syntax is CLASS lcl_truck DEFINITION INHERITING FROM lcl_vehicle. b) Redefining Methods c) 8. Visibility in Inheritance: Public: Visible to all Protected: Only visible within the class and its subclasses Private: Only visible within the class and not even its subclass. 9. Interface: They dont contain any implementation. a) Interface provides only services. The user never actually knows the providers of these services, but communicates with them through the interface. b) In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces. c) Syntax: INTERFACE test METHODS: display. ENDINTERFACE. INTERFACES test METHOD test~display. Lcl_vehicle-> test~display. (obj ref should refer to class which implements interface) 10. Compound Interface: A compound interface contains other interfaces as components (component interfaces) and summarizes the extension of these component interfaces. 11. Events: By triggering an event, an object or class announces a change of state, or that a certain state has been achieved.