Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

events and interfaces

Former Member
0 Likes
500

Dear Experts ,

plz explain me this events and interfaces with some suitable example , im unable to understand this . I m new in oo abap .plz help me.

if you have anyb documents regarding oo abap , plz send me .

Thanks .

Dear Experts ,

plz explain me this events and interfaces with some suitable example , im unable to understand this . I m new in oo abap .plz help me.

if you have anyb documents regarding oo abap , plz send me .

Thanks .

3 REPLIES 3
Read only

Former Member
0 Likes
456

hi,

hope it helps..

Interfaces are used to define the model of a class.

They also like classes can be either local or global.

Global interfaces are defined through SE24 and local interfaces are defined in program.

Local interface definition

INTERFACE i_bike.

METHODS drive.

ENDINTERFACE.

Interfaces can be used in classes

CLASS c_bicycle DEFINITION.

 PUBLIC SECTION.     

INTERFACES i_bike.

  PRIVATE SECTION.

   DATA: speed TYPE i.

ENDCLASS.

CLASS c_bicycle IMPLEMENTATION.

 METHOD i_bike~drive.

    speed = speed  + 10.

  ENDMETHOD.

ENDCLASS.

Reward if hepful.

Regards,

Srishti

Read only

Former Member
0 Likes
456

Interface

In its most common form, an interface is a group of related methods with empty bodies. A bicycle's behavior, if specified as an interface, might appear as follows:

interface Bicycle {

void changeCadence(int newValue);

void changeGear(int newValue);

void speedUp(int increment);

void applyBrakes(int decrement);

}

To implement this interface, the name of your class would change (to ACMEBicycle, for example), and you'd use the implements keyword in the class declaration:

class ACMEBicycle implements Bicycle {

// remainder of this class implemented as before

}

Implementing an interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler. If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile.

Event

Event is a platform-independent class that encapsulates events from the platform's Graphical User Interface in the Java 1.0 event model. In Java 1.1 and later versions, the Event class is maintained only for backwards compatibilty.

They are definetely declared in classes. These concepts are related to one other for declaring methods and handling events in our program.

please go through the following links fotr your future reference.[ABAP Objects Examples ][ ABAP Objects Wiki section]

hope its clear to you.

reward points if useful.

Regards,

kalyan.