2008 Feb 27 9:22 AM
what is an interface?
what is polymorphism?
hi frds plz give me response to my mail id
2008 Feb 27 9:40 AM
Hi ,
OOPS : ABAP Objects, the object-oriented (OO) extension to the ABAP language, is available with releases 4.5 and 4.6. Release 4.6 adds inheritance, nested interfaces, and dynamic method invocation. In this article, as two of the developers of this new extension, well take you through an introduction to ABAP Objects and give you a comprehensive example (The code for the example can be tested and debugged in DEMO_ABAP_OBJECTS in R/3 release 4.6 or higher).
ABAP Objects is a nearly 100 percent upward-compatible extension of ABAP that includes a full set of OO features. We left out some obsolete language elements in the OO context within classes (so it is not truly 100 percent compatible), but you can use objects in all contexts without any restrictions.
We created ABAP Objects because:
The business object repository (BOR) already presented an OO view of the system to the outside, and we wanted a common programming model for both outside and inside.
We wanted the potential benefits of objects within R/3, including better control of complexity, a better means for encapsulation, extensibility, and reuse, and a language basis for patterns and frameworks.
We wanted seamless integration with external object models (DCOM and CORBA).
We needed objects to be the foundation for a new GUI programming model (to be completed in release 5.0).
At the beginning of the ABAP Objects project, we faced a fundamental question: Should we add OO features to the existing ABAP language, invent a completely new language, or integrate an existing OO language into R/3? We opted to integrate OO features into the existing ABAP language to create ABAP Objects for several reasons:
It meant we would immediately inherit all the other features of the R/3 infrastructure such as software logistics, portable database access, TP monitor capabilities, and all database buffering and scalability.
Certain features, such as persistence, transactions, events, and GUI frameworks, are hard to add on top of a language. This results in lots of generated code. To support these concepts, you must have your own compiler or interpreter and runtime, ruling out most off-the-shelf languages.
Our target was a language for business applications. We wanted it to be simpler than Java and C++ and to leave out complex concepts lacking in benefits.
By integrating the concepts of OO languagesas opposed to using a specific OO languageinto ABAP, we were able to combine the best concepts from these languages and adapt them, when needed, to our specific needs. <
<CHECK UR MAIL ID>
Thx
Jagadeesh
Edited by: Jagadeshwar Gollapelly on Feb 27, 2008 10:41 AM
2008 Feb 27 9:45 AM
Hi,
Interfaces are independent structures that allow you to enhance the class-specific public points of contact by implementing them in classes.
Interfaces can be defined globally in the R/3 repository or locally in ABAP program
Can define exactly same components in Interfaces as in Classes
Unlike classes, Interfaces do not have instances, instead they are implemented by classes
Implemented using INTERFACES statement in the declaration part of the class
INTERFACES statement must be included in the PUBLIC SECTION of the class
Different classes that implement the same interface can all be addressed in the same way.
Interface references allow users to address different classes in the same manner.
Interfaces can also be nested.
Interfaces are the basis for polymorphism in classes, because they allow a single interface method to behave differently in different classes.
Polymorphism:
Reference variables are defined with reference to a superclass or an interface defined with reference to it can also contain references to any of its subclasses. A reference variable defined with reference to a superclass or an interface implemented by a superclass can contain references to instances of any of its subclasses, since subclasses contain all of the components of all of their superclasses and also convey that the interfaces of methods cannot be changed. In particular, you can define the target variable with reference to the generic class OBJECT.
Using the CREATE OBJECT statement, when you create an object and a reference variable typed with reference to a subclass then you can use the TY PE addition to which the reference in the reference variable will point.
A reference variable can be used by a static user to address the components visible to it in the superclass to which the reference variable refers. However, any specialization implemented in the subclass cannot be addressed by it.
Depending on the position in the inheritance tree at which the referenced object occurs, you can use a single reference variable to call different implementations of the method. This is possible only if you redefine an instance method in one or more subclasses. This concept is called polymorphism, in which different classes can have the same interface and, therefore, be addressed using reference variables with a single type.
Have a look at this link.
http://help.sap.com/saphelp_46c/helpdata/en/22/042427488911d189490000e829fbbd/content.htm
Other type of Interfaces are
http://help.sap.com/saphelp_nw70/helpdata/en/ec/d9ab291b0b11d295400000e8353423/content.htm
Check the forum links below:
INTERFACES
Cheers,
vasavi.
kindly reward if helpful.