Application Development 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: 

interface

Former Member
0 Kudos
174

Do the Interface can contain static componenets (static methods,attributes).Does the interface contains attributes like that of a class.

3 REPLIES 3

0 Kudos
54

From a technical point of view, interfaces are simply superclasses that cannot be instantiated, do not have an implementation part, and only have public components.

In ABAP Objects, interfaces primarily serve to define uniform interfaces (protocols) for services. Various classes can offer (that is, implement) these services in different ways, but keep the same semantics. Interfaces contain no implementation.

Former Member
0 Kudos
54

Hi

Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.

Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.

The user never actually knows the providers of these services, but communicates with them through the interface.

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.

<b>Interfaces features</b>

Sepearation of external point of contact ( intrafce ) and implementation(class)

- the client defines the protocol , the server implements it

- “ Black Box Principle “ client only knows the interface , not the implementation

- lowest linkage between client and server

Polymorphism

- generic handling of objects of different classes

Abstraction

- interface as a generalization of the implementing class

Simulation of multiple inheritance

<b>Working with Interface components</b>

You can access interface components using an object reference, whose class implements the interface. Syntactically this is done with the interface resolution operator, just as with the method definitions in the implementation part of the class.

varma_narayana
Active Contributor
0 Kudos
54

Hi ..

Yes

Interfaces can contain Static components.

Interface can contain all the Components like a class:

1. Attributes

2. Methods

3. Events

4. Interfaces.

But all these are PUBLIC components by default.

reward if Helpful.