Diffrence between a Interface and a abstract class?

Hi OO ABAP Gurus
Please clear below point to me.
Diffrence between a Interface and a abstract class?
Many thanks
Sandeep Sharma..

Hi
Abstract classes
Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
Classes with at least one abstract method are themselves abstract.
Static methods and constructors cannot be abstract.
You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
Reference to abstract classes can refer to instance of subclass
Abstract (instance) methods are difined in the class , but not implemented
They must be redefined in subclasses
CLASS LC1 DEFINAITION ABSTARCT
PUBLIC SECTION
METHODS ESTIMATE ABSTARCT IMPORTING…
ENDCLASS.
Interfaces
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.
Interfaces features
INTERFACE I_COUNTER.
METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,           INCREMENT_COUNTER, ENDINTERFACE.
CLASS C_COUNTER1 DEFINITION.   PUBLIC SECTION.
    INTERFACES I_COUNTER.
  PRIVATE SECTION.
    DATA COUNT TYPE I.
ENDCLASS.
CLASS C_COUNTER1 IMPLEMENTATION.
  METHOD I_COUNTER~SET_COUNTER.
    COUNT = SET_VALUE.
  ENDMETHOD.
  METHOD I_COUNTER~INCREMENT_COUNTER.
    ADD 1 TO COUNT.
  ENDMETHOD.
ENDCLASS.
Refer
https://forums.sdn.sap.com/click.jspa?searchID=10535251&messageID=2902116
Regards
Kiran

Similar Messages

  • When to use interface and when Abstract Class?

    In a recent interview I was asked "When to use interface and when Abstract Class?" Explain with an example.
    Also in what situations a class should be made final(real time example)

    Interface is a pure contract with no implementation. Typically used to define a communication contract between two different sub-systems. Example EJB home interface. This also allows the design to change as long as the contract is met.
    Abstract class is when there exists a lot of common functionality already known and can be coded. However, a few unknowns exists (typically about data) for which abstract methods need to be defined and implemented by the sub class.
    Example: Consider a workflow engine. A great example for abstract class. The workflow process has lot of common code that is independent of the workflow type (vendor flow, contract flow, payment flow etc). However, certain decisions on the route to take will depend on value of data being submitted. So the base class will define a abstract Data getData() method and proceed assuming data will come. The implementing subclass will provide the actual logic for getting the data.
    Also see the "Template" design pattern.
    Note: To some extent the common code design drives the behavior of the abstract methods. So if the design changes then so "might" the behavior expected from the abstract methods.

  • Whats the difference between an INTERFACE and a CLASS?

    Whats the difference between an INTERFACE and a CLASS?
    Please help.
    Thanx.

    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=Difference+between+interface+and+class

  • Diffrence between N85-1 and N85-a

    is there any Hardware/Software Diffrence between N85-1 And N85-a ?

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    Interfaces
    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.
    Interfaces features
    INTERFACE I_COUNTER.
    METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,           INCREMENT_COUNTER, ENDINTERFACE.
    CLASS C_COUNTER1 DEFINITION.   PUBLIC SECTION.
        INTERFACES I_COUNTER.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER1 IMPLEMENTATION.
      METHOD I_COUNTER~SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD I_COUNTER~INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
    ENDCLASS.
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=10535251&messageID=2902116
    Regards
    Kiran

  • What is the diffrence between sap events and application events

    Hi all,
    what is the diffrence between sap events and application events.Can any one tell me with examples.
    regards,

    Hi,
    Look at this,
    <b>System Events (Default)</b>
    The event is passed to the application server, but does not trigger the PAI. If you have registered an event handler method in your ABAP program for the event (using the SET HANDLER statement), this method is executed on the application server.
    Within the event handler method, you can use the static method SET_NEW_OK_CODE of the global class CL_GUI_CFW to set a function code and trigger the PAI event yourself. After the PAI has been processed, the PBO event of the next screen is triggered.
    The advantage of using this technique is that the event handler method is executed automatically and there are no conflicts with the automatic input checks associated with the screen. The disadvantage is that the contents of the screen fields are not transported to the program, which means that obsolete values could appear on the next screen. You can work around this by using the SET_NEW_OK_CODE method to trigger field transport and the PAI event after the event handler has finished.
    <b>Application Events</b>
    The event is passed to the application server, and triggers the PAI. The function code that you pass contains an internal identifier. You do not have to evaluate this in your ABAP program. Instead, if you want to handle the event, you must include a method call in a PAI dialog module for the static method DISPATCH of the global class CL_GUI_CFW. If you have defined an event handler method in your ABAP program for the event (using the SET HANDLER statement), the DISPATCH method calls it. After the event handler has been processed, control returns to the PAI event after the DISPATCH statement and PAI processing continues.
    The advantage of this is that you can specify yourself the point at which the event is handled, and the contents of the screen fields are transported to the application server beforehand. The disadvantage is that this kind of event handling can lead to conflicts with the automatic input checks on the screen, causing events to be lost.
    Hope u understood.
    Thanks&Regards,
    Ruthra.R

  • What is the diffrence between a javabean and  EJB

    hi!
    what is the diffrence between a javabean and entreprise jvaabeans! i mean which are the uitilization featires of eaxh one !

    i am seeking for a solution for my problem , in fact i ma trying to implement and develop an application with java that allows a certain range of IP adresses to be connected to a database server in order to extract the suitable data from the server .
    let me explain mor ethe suitation , in fact what i am loking for is to use javabeans to grant my application much more consistence and pertinence : si i am asking if it could be possible to use javabeans in my case especially if i am not trying to developp a web application but a cleint /server one allowing some services.
    The application is in fact dealing with a stock exchange market and what i am trying to do is to grant particilar registrated customers to have the informations that they need ( portofolio, currency's status, market indicators, .) also drawing some charts decribing rates, variations, and others specefic financial caracterestics .So , if we consider that this application is not a web application ( no HTTP request and no servers like apache or others ) how it is possible to use javabeans and not EJB to build the application? i mean what could be suitable and preferable to rely on and dvelop to ensure a good java application !!
    if you need more details to help you find the answer for me don't hesitate to answer me back !!
    Someone here gave me that answer
    use RMI to code the services and (Updateable) Value Objects to pass the information between tiers.
    RMI is an all-java distributed component framework (ie. EJB, CORBA, DCE/RPC, DCOM, etc.), that is very suitable for developing non-containerized multi-tier applications. Refer to the RMI trail in the Java Tutorial as a starting point for coding RMI solutions (http://java.sun.com/docs/books/tutorial/index.html). Under this scenario you would code the database access service as an RMI service (server-side). Client/server communication should be facilitated through the use of JavaBeans/classes that wrap the information being passed (customer information, portfolio details, market information, etc.) - these are refered to as 'Updateable Value Objects' (a design pattern). Graphing and charting would be handled in your client from the information received from the (RMI) server. GUI JavaBeans can be used to provide this functionality as well as other client-side services. There are numerous "shrink-wrapped" components for GUIs available on the market just peruse any Java magazine to find them.
    but how comes? how can i do it !! and where can i find more information please about 'Updateable Value Object "
    thanks

  • Why interfaces why not abstract classes?

    why they are using interfaces concept in JDBC or struts2.0 why not abstract classes?
    thanks in advance.

    user5287726 wrote:
    jverd wrote:
    user5287726 wrote:
    Interfaces are more flexible. For certain definitions of flexible, yes, but not for others.
    A Java class can only inherit one class, but it can implement multiple interfaces.Which has absolutely nothing to do with why JDBC declares interfaces rather than abstract classes.How does your post even attempt to answer the OP's question?OP asked: "why they are using interfaces concept in JDBC or struts2.0 why not abstract classes?" I'm pointing out that your post does not address the question asked. And of course your answer is wrong anyway.
    As for addressing the OP's question, I did that in my first response.

  • What is the diffrence between K7T266 Pro and Pro2?

    What is the diffrence between the pro and the pro 2, besides the pro2 being red and having the link lights. Upto what CPU and what type can the pro 1.0 handle? Also, can it be moded to fit a better cpu? Anyone know?
    -Nick

    Pro has the KT266 chipset
    Pro2 has the KT266A chipset
    KT266A has improvements that increase performance, and the Pro2 can be modified to fit Thoroughbred CPUs.
    The Pro (KT266) can only accept up to the Athlon 2000+ palomino.  Also, overclocking the FSB disables USB; this was fixed with the KT266A.

  • What is the diffrence between SAP View and CAD View ?

    What is the diffrence between SAP View and CAD View ?
    What is the main purpose of SAP View
    and
    What is the main purpose of CAD View
    On SAP help i found
    SAP View is used for :The SAP view displays the SAP structure (document-based structure) for the active CAD object, or another document info record (header document), with a single-level or multilevel document structure in a tree structure. You can variably configure the fields using the layout editor.
    CAD View is used for :The CAD view displays the document-based structure of the currently active CAD object, such as the structure of an assembly. The CAD system determines the complete (multilevel) structure and copies it either completely or in stages to the SAP system, in accordance with the default explosion level.
    BUT I did not understand it well
    Can someone explain this with an example
    THanks
    Raj

    Hello Raj,
    SAP View  can be further described as the view that is based on what is existing already in the SAP system. This view is generally used by SAP purchasing, MM people etc
    CAD view is nothing but the replication of the model tree view in the SAP system. This is used by the design engineer and this view replicates only the parts that are actively displayed on the CAD tool window.
    hope this helps. Let me know if you have further questions else please close the message.
    regards
    N K

  • What is the Diffrence between Oracle 11 and 11i

    What is the Diffrence between Oracle 11 and Oracle11i ?.
    With Rgds
    Arun J.Isaac

    Oracle 11i is internet based and run with java platform where we can see the applets downloading alongwith oracle forms and it refreshes all the jar files in oracle default directory.
    Oracle 11 is not intergrated with Java its an Oracle standalone platform.
    Regards,
    Arumugam S.

  • Remote Desktop cannot verify the identity of the computer because there is a time or date diffrence between your computer and remote computer

    Hello.....
    I'm not able to log into Windows Server 2008 r2 server thorugh Remote Desktop connection, receiving below error message.
    This issue is with only three servers in the environment
    "Remote Desktop cannot verify the identity of the computer because there is a time or date diffrence between your computer and remote computer......"
    The date/time is correct on the server when i checked in the console session of the server
    Can see below messages in event logs
    Event ID 1014:
    "Name resolution for the name XYZdomain.com timed out after none of the configured DNS servers responded."
    Event ID 1053:
    The processing of Group Policy failed. Windows could not resolve the user name. This could be caused by one of more of the following:
    a) Name Resolution failure on the current domain controller.
    b) Active Directory Replication Latency (an account created on another domain controller has not replicated to the current domain controller).
    Any thoughts ....

    Hi,
    Have you tried to connect these three servers with IP address instead of computer name or DNS name?
    Check Remote Desktop Connection settings: Option-->Advanced-->Connect from anywhere-->Settings-->Connection Settings-->Select “Do not user an RD Gateway server”
    For more information please refer to following MS articles:
    Remote Desktop cannot verify the identity of the remote computer because there is a time or date difference between your computer and the remote computer
    http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/c1f64836-5606-49b0-82eb-56be7f696520
    Cannot connect via Remote Desktop
    http://social.technet.microsoft.com/Forums/en-US/windowsserver2008r2general/thread/5087e897-8313-468c-ad37-ef18b87d4dd6
    Lawrence
    TechNet Community Support

  • Diffrence between File Transport and CTS+ Transport in PI

    Hi Guys,
       Can you please explain me the diffrence between File Transport and CTS+ Transport in PI.
       What are the advantages of CTS+ Transportation over FILE Transportation...
    Thanks,
    Siva...

    The file transfer will simply export the objects to a TPZ file, allowing you to import on the target system. This requires manual copying and paste of the object and have no further control.
    CTS+ on the other side, allows the environment to maintain transport requests with control over objects audit. For example, an object must be created on DEV, then after being developed it must go to QA system and will only be sent to PROD when this object was approved by the respective team on QA. For more information on CTS+, please check the help page below.
    http://help.sap.com/saphelp_nwpi71/helpdata/en/9a/775de286874bc78dcb1470bc80f0f9/frameset.htm
    Also the documentation below will provide a more complete overview and configuration steps for the CTS+ usage
    "http://www.sdn.sap.com/irj/scn/go/portal/prtroot/com.sap.km.cm.docs/library/application-lifecycle-management/lifecycle-management/software-logistics/new%20features%20in%20sap%20enhancement%20package%201%20for%20sap%20netweaver%207.0.pdf"
    Please also refer to the SDN thread below
    How to move PI objects in IR and ID from DEV to QAS

  • Differences between Convensional interfaces and XI interfaces

    Differences between Convensional interfaces and XI interfaces

    hi,
    wat do u mean my "Convensional interfaces"?
    let me know.
    kvr

  • Diffrence between TDS report and actual TDS

    A report required which will show diffrence between TDS report and actual TDS, to get status of tds (liability/receivable) or to compare it.
    so, how to get it in system???
    I want information/ suggestions for standard and Z development both....
    waiting.....
    Regards,
    Sachin

    The below is perfect report for TDS.
    Just copy the below and provide it to your ABAPER and ask him to develop the Z REPORT
    Technical Field     Description          Table Name     Selection screen     Output file
    BUKRS                  Company code          BKPF               Y                            Y
    BELNR                 Accounting doc number     BKPF               Y                            Y
    XBLNR                 Reference (Voucher Number)     BKPF                                 Y
    GJAHR                 Fiscal year          BKPF               Y                            Y
    WITHT                 WHT Type          WITH_ITEM                                 Y
    WT_WITHCD            WHT Code          WITH_ITEM                                 Y
    WT_QSSHH                 WHT base amount in LC     WITH_ITEM                                 Y
    WT_QBSHH                WHT Amount in LC          WITH_ITEM                                 Y
    QSREC                Recipient type          WITH_ITEM                                 Y
    BUDAT                Posting date          BKPF               Y                            Y
    BLDAT                Document date          BKPF               Y                            Y
    PRCTR                Profit Center          BSEG               Y                            Y
    BUPLA                Business Place          BSIS               Y                            Y
    QSATZ                WHT Tax Rate          WITH_ITEM                                 Y
    LIFNR               Account no of the Vendor     J_1IMOVEND         Y                           Y
    J_1IPANNO               PAN Number          J_1IMOVEND          Y
    NAME1                Vendor name          LFA1                                 Y
    QSCOD               Off WHT key          T059Z               Y                           Y
    PSWBT               G/L Amount          BSEG                               Y
    Hope it helps
    Thnks

  • Can I know where exactly I can go for an interface and an abstract

    can I know where exactly I can go for an interface and an abstract???
    with a simple program???

    You mean an example? Any introduction to Java textbook should have that.

Maybe you are looking for

  • How can I transfer my music library playlists from ipod to computer itunes library?

    I have a new computer and would like to know how to transfer my entire music collection/playlists from my ipod back to my itunes library.

  • More than 2GB of RAM?

    I have a 20"2Ghz iMac ALS with 2GB of RAM. Can I upgrade to 4GB? Thank you.

  • SAP License key

    Dear All, We have an issue with system number in our production system. We have generated SAP license key for production during our SAP implimentations. But after that due to some major problem we have again reinstall SAP system and regenerate SAP Li

  • What's cyclic dev in Solaris 10?  how to install it?

    I install java Real-Time System in my solaris 10 and use commend to verify evn, get some error messages. # java -version Could not open /dev/cyclic (No such file or directory). Please check that the cyclic device driver is correctly installed on your

  • Add or edit step(s) dynamically in a sequence

    I am trying to add or edit step(s) dynamically in a sequence, based on the response from the user to a ui.  If I can not do this in the Test Stand language, how would I do it using a LabVIEW vi and  programmatically put that into a Test Stand sequenc