Professional Documents
Culture Documents
Topic Objectives
Describe the Advantages of Object Orientation Define Classes, Attributes, and Methods Define the Reference Concept Describe Interfaces and Events
Encapsulation
Interface Creation
Encapsulation
Program: . . .
add 1 to passenger_list
Data: passenger_list
No access
Object Attributes
CONNID 0400 19980126 FLDATE
Private Access
CARRID Method: BOOK
Public Access
Instances
Instances
Classes
CLASS <class> DEFINITION. * INHERITING FROM <superclass> -- available in a later 4.0 version
PUBLIC SECTION. definition of components visible outside the class PROTECTED SECTION. definition of components only visible to subclasses of this class. PRIVATE SECTION. definition of components only visible within the class ENDCLASS. CLASS <class> IMPLEMENTATION. method implementations ENDCLASS.
| CLASS-DATA} attr TYPE type [ [ [ [ VALUE val ] READ-ONLY ] VIRTUAL [ SET-METHOD set-method ] GET-METHOD get-method ] ].
{METHODS
[ [ [ [ [
| CLASS-METHODS} method IMPORTING <list of import parameters> ] EXPORTING <list of export parameters> ] CHANGING <list of import/export parameters> ] EXCEPTIONS <list of export exceptions> ] RETURNING result TYPE t ].
Reference Concept
Object Reference Object Reference
Instances
Interfaces
Interface Reservation
Class Hotel
Instances
INTERFACE interface. [ INTERFACES <list of comprised interfaces> ] [ <definition of interface components> ] ENDINTERFACE.
Events
Event Handling Classes Event raising class Event Table
Event Source
CLASS CGUIbutton IMPLEMENTATION. METHOD anymethod. RAISE EVENT Clicked EXPORTING doubleclick = 0. ENDMETHOD. ENDCLASS.
Exercise
Exercise 47 - Creating and Using a Class, 60 minutes
Any questions?