Diff between  ABSTRACT  & INTERFACE.

can I know the exact difference between abstract and interface
and also can I know where exactly what can be used. if possible briefly with programs.

An abstract class is meant to be used only when you have a class of a type that will never have an instance, but from which classes are actual types of. For example, class Fruit would demonstrait the qualities required for an abstract class. You should never, in the real world, have an instance of Fruit that isn't actually some kind of Fruit; there's no such thing as the instance of an abstract Fruit. However, there are common traits between apples, oranges, bannanas, etc. Therefor it would make sense to have an abstract class, Fruit, from which the classes Apple, Bannana, Orange, Pear, Peach, etc.. extend. This way you could treat all of these objects as Fruits by upcasting, but you wouldn't have to worry about a generic fruit being created.
An interface is different, it's not a "is a" relationship, but rather an interface between one object and another (Apropriately named isn't it?). It's meant to be used only as a communication channel between objects. For instance, an eyeball would be a good example of an object that has a communication interface. An eyeball watches for information being presented to it and turns it into Images for the Brain, for this purpose there could exist a EyeListener interface:
public interface EyeListener
public void informationReceived(BufferedImage myImage);
Now, the eyeball will just hang out and produce images for the Brain, or whatever other information processing units that will exist in the future that implement the EyeListener interface (Neural CPUs running Java Bytecode). I think it's fairly obvious how a Brain lacks any kind of relationship to the Type Eye, but has a strong relationship with the two instances of Eye it works with.
Another way to solve the problem of providing a communication interface between these two things would be to call the Brain a type of "Eye", and simply extend Eye and override the informationReceived method to get the Image information it produces. And in C++, strangely enough, this kind of use of Object Orientation is fairly common.
And I think everybody can see that there is something really extremely wrong with this.
And you should see by now that relationships that require interfaces are MUCH more common that relationships that would involve an abstract class. Thinking about the relationships this way makes the Class Eye more flexable, and allows it to hide a great deal of it's implementation behind the interface.
-Jason Thomas.

Similar Messages

  • Difference between abstract interface and normal interface

    Hello Friends,
    What is the Difference between abstract interface and normal interface?....

    What is the Difference between abstract interface and
    normal interface?....The difference is that you didn't follow convention in the first case. All interfaces are implicitly abstract so you don't have to declare them as such.

  • Abstract Interface in XI

    Hi Experts,
    Is the concept of Abstract Interface same as that of Java?
    I know that the abstract interface is used in BPM and it doesnt have any direction. Any special use of abstract??
    Please suggest.
    Regards,
    Sushama

    Hi Sushma,
    When you're defining an interface in Java, it's always abstract, though you
    don't need to declare them as such.
    So there's no difference between
    abstract interface I
    void method();
    ....and...
    interface I
    void method();
    I think
    but abstract interfaces in XI are different for Java abstract.
    Thanks,
    Sateesh

  • Abstract interfaces between diff swcvs

    Hi Guys,
    I am designing BPM under my own SWCV. I need to use two abstract interfaces which were defined in entirely different SWCV.
    My scenario is like Proxy-BPM-SOAP. The scenario is synchronus but the Proxy side i have two seperate interfcaes as outbound (Asynch) and inbound (Asynch) instead of a single synchronus interface.
    I have created 2 abstract interfaces for these 2 interfaces and i need to use them under my own SWCV where i am designing the BPM process
    any help would be appreciated
    Thanks,
    srini

    Hi,
    From SAP Help.
    An integration process can only reference interfaces from its own software component version.
    Check this link under the topic abstract interface.
    http://help.sap.com/saphelp_nw70/helpdata/en/78/62373f58502e48e10000000a114084/content.htm
    Regards,
    Sudheer.

  • Difference between Abstract Classes Vs Interface

    Hi,
    Can u pls mention all the differences between Abstract Classes and Interface.? I've mentioned the differences I've known here.
    Known Differences:
    (*) An interface cannot implement any methods, whereas an abstract class can.
    (*) A class can implement many interfaces but can have only one superclass
    Can U pls mention at what situation(practical situation) we've to go for abstract class or Interface?
    Tell me the situation when we have to go for abstract class?
    Tell me the situation when we have to go for interface?
    Please Reply me
    Thanks & Regards
    Venkatesh

    There are more differences, and one really important is that abstract classes can also define class variables, while interfaces cannot. I think the question of when to use interfaces or abstract classes is not always easy to answer, but yourself have pointed some tips you should be aware of :
    If you need that some funcionality of the class is derived by more than one "parent" then you should use interfaces, since you cannot extend more than one class.
    If your "superclass" needs to define some class variables then the choice must be made to have a superclass and then extend it. Also this is applicable if there is a method that can be programmed at a higher level (in interfaces you cannot program methods).
    But the answer to the question is still not easy. And remember, you can always mix both tipes, you can extend one class and implement some interfaces.
    Examples or that are very common in the Java API for AWT or Swing components, for example javax.swing.JLabel extends javax.swing.JComponent (that is beacuse a JLabel IS a JComponent and it uses some variables and methods programmed at the JComponent "level") and it also implements some interfaces: Accessible, ImageObserver, MenuContainer, Serializable & SwingConstants.
    I hope this helps.
    Zerjillo

  • Diff Between Interfaces and API

    Hi to all.
    Can anybody tell me , What is the basic diff between API and Interfaces ?
    Thanks in advance

    Hi Lalit,
    Both place validation will happen. In Interface table as well as in API.
    The difference you can say..for interface you have to load the data in and invoke the import program by which it will populate data in oracle apps base table. So you have to write some DML.
    While in API you can simply use PLSQL record type and using that invoke API by which it will populate record in oracle apps base table.
    Keep in mind both ways the validation happens. It is just the approach and some part is just for legacy data conversion.
    Regards
    Prashant Pathak

  • What is the difference between Abstract class and Interface ?

    Hi,
    Could u plz tell me the difference between Abstract class and Interface?
    Thanks in advance.
    Gopi

    Lots.
    An abstract class can contain some method implementations, or indeed all the method implementations. It may contain methods with all the various access modifiers. It cannot be instantiated. A class may inherit from only a single abstract class.
    An interface contains only public method stubs and constants. A class may implement multiple interfaces. An interface cannot (obviously) be instantiated.
    Abstract classes are particularly useful when you need to provide a semi-complete implementation for reuse. Interfaces are used more like types.
    Look at java.util.* for some good examples of the use of both.

  • Difference between abstract classes and interfaces

    I actually wonder about what are the differences between abstract classes and interfaces may somebody give an example code about it?
    and i have one more question how can i use interfaces like multiple inheritance ? i mean when i implement an interface like
    class a extends b implements c,di have to use all c and d methods but what that methods means?
    I mean as i know we cannot make implementations of methods in interfaces
    but for example in runnable interface there is a method like run() and it has been defined somewhere because it knows what to do(i mean when it will run), i just write my code into that method .

    Once you get past the starting point (I am referring to the OP here), there are a few salient differences:
    You can only extend (or generalize) a single superclass; however, you can implement (or realize) multiple interfaces. As such, all things being equal, using an interface in lieu of an abstract class 'frees' your design. Later, if you want the implementor of an interface to inherit from another class, there is not issue.
    Any abstract method specifies a contract. However, abstract classes allow you to also add common behavior to subclasses. This is an overused justification for abstract classes, IMO. You can achieve the same effect using delegation and still having interfaces.
    Always program to interfaces wherever possible. This means that you define an interface and have an implementing class (usually at a minimum). Do not do this for all your classes, but rather the ones that make your system unique (the domain model or M in MVC architecture). This allows you to later change implementation with a minimal amount of refactoring. This is a core precept from the Group of Four and any number of decent programming books.Best of luck.
    - Saish

  • 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

  • Integration Process of abstract interfaces of diff SWCV's

    Hey all,
    I am trying to create an integration process of a sender and receiver abstract interfaces of different SWCV’s. If I create the integration process in one of the SWCV, I am not able to select the other interface in the receive step.Is it a necessary criteria to have the both sender and receiver abstract interfaces to be in the same SWCV? Can they not be in different SWCV?
    -AR

    Hi Antonio,
    CLEAR SLD CACHE is not enough. After your SWCV update in SLD, you need to import again your SWVC inside IR.
    All your objects will be NOT deleted. Thus don't worry about your Data Type, Mappings, BPM, etc...
    I have already done such an import (after adding a usage-depency), I have never lose an object.
    If you are some doubt, you can Export all your namespaces in a file (cf. Tools > Export). Thus you will be able to Import all your namespaces if something will be wrong (but it will be not the case!). Ask to your admin to get this file in order to NOT send it to your production system...
    Regards
    Mickael
    Message was edited by: Mickael Huchet

  • In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    hello all
    In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    Hi Swamy,
    The differences between IDoc and BAPI are as follows: 
    IDOC
    IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system.
    Idocs are processed asynchronously and no information whatsoever is returned to the client.
    The target system need not be always online. The IDOC would be created and would send the IDOC once the target system is available (tRFC concept). Hence supports guaranteed delivery.
    With asynchronous links the sub-process on the client can be finished even if the communication line or the server is not available. In this case the message is stored in the database and the communication can be done later.
    The disadvantage of asynchronous links is that the sub-process on the server cannot return information to the calling sub-process on the client. A special way for sending information back to the client is required. In addition, a special error handling mechanism is required to handle errors on the receiving side.
    IDOCs may be more changeable from release to release.
    IDOCs  are poorly documented.
    BAPI
    BAPIs are a subset of the RFC-enabled function modules, especially designed as Application Programming Interface (API) to the SAP business object, or in other words: are function modules officially released by SAP to be called from external programs.
    BAPIs are called synchronously and (usually) return information.
    For BAPIs the client code needs to do the appropriate error handling.
    Problems with synchronous links occur if the communication line or the server is temporarily not available. If this happens, the sub-process on the client cannot be finished (otherwise there would be data inconsistencies).
    Synchronous links have the advantage that the sub-process on the server can return values to the sub-process on the client that has started the link.
    BAPIs are not totally immune to upgrades.
    BAPIs are reasonably well documented.
    Reward points if useful.
    Best Regards,
    Sekhar

  • BPM Abstract Interface for IDOC?

    Hi all,
    I am doing an IDOC XI File scenario with BPM.
    I have created an Inbound Asynchronous and an Abstract Interface for the LEGACY SYSTEM(Target Message).
    I didn't create any Abstract interface for the IDOC(Source message).
    I am getting this error:
    <b>"Expression must return the interface type DEBMAS.DEBMAS06.DEBMAS06".</b>
    Do I need to create an Abstarct Interface for the IDOC?
    According to the above error, BPM is expecting an ABSTRACT INTERFACE Type for the IDOC.
    Experts need help from you.
    Thank you,
    Joslyn.

    That mapping is an dummy mapping between Idoc to Abstract Idoc Type. Here Sender Idoc Interface is mapped with Reciever Abstract Idoc interface.
    So inside the BPM, Abstract Idoc interface acts as a Container variable to collect the idocs.
    For simplicity-for collection of idocs
    You can see, BPMPatterns from the SAP BASIS Software Component in your XI Repository.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm
    Regards,
    Moorthy

  • Regarding Abstract Interface

    Hello,
    What makes the difference between the Normal Interfaces and Abstract Interfaces. Is there any technical differences between these two interfaces.
    Thank you

    Hi,
    You use a message interface to describe a platform-independent or programming-language-independent interface, which you want to use to exchange messages between application components using SAP Exchange Infrastructure.
    When you create a message interface you define the communication parameters by using the attributes Mode and Category as Sync/Async, Inbound/Outbound or Abstract.
    Message interfaces of this category can perform the role of an inbound or outbound interface within integration processes, depending on whether it is used to send or receive a message. For this reason, no direction is specified during definition. In integration processes, you can use the same abstract interface to receive and send a message. Abstract message interfaces generally receive the message from an outbound interface of a sender system and send it to an inbound interface of a receiver system, thus performing a complementary role.
    BPM can interact and deal with only Abstract Interfaces. And so, if you have a transformation step inside the BPM , the source and target interface will have to be abstract interfaces.
    These characteristics determine the direction of an interface:
    ·        An outbound interface sends a request message that is only used to make a communication party aware of data sent, without waiting for a response message. In the case of the latter, we also refer to publishing interfaces.
    ·        An inbound interface receives a request message that you reply to with a direct response message or whose data you can process in the system without a response.
    Thanks
    Swarup

  • IDOC Abstract Interface

    I assigned IDOC to an Integration Process. During design I did an interface mapping between the IDOC and the Abstract Interface of the IP. I have to assign a Message Mapping to the interface mapping.
    1. As the structures are the same do I need a Message Mapping.
    2.I am following an answer Yes for 1 and created a Message Mapping with same structure on both sides. Now I have to map all these IDOC fields. Any easy way to map by one drag and drop.

    Hi,
    If you want to use the Idocs in the BPM , then abstract interfaces are required.
    <i> During design I did an interface mapping between the IDOC and the Abstract Interface of the IP</i>
    Is it mean, the same idoc absract Interface as a target here ?
    <i>1. As the structures are the same do I need a Message Mapping.</i>
    >> Not required.
    If your Idoc is in the SWC of the Integration Process and you have defined the Absract Interface for the Idoc type, then it is not required to create the mapping here. You can directly use i.e you can receive the Idoc message in the Idoc Abstract Interface.
    Regards,
    Moorthy

  • ABSTRACT INTERFACE

    Hi,
       I'm doing file to file scenario with BPM's ... in ABSTRACT INTEFACE  wich message type we need to select.. Whether Sender  Message type  or Receiver message type.. which one we need to select..
    and  if i have <b>two  sender files..</b> and <b>one reciver file</b>.. then how many message mappings  and  how many inteface mappings i need to create... in the BPM scenario
    thansk
    Babu

    i,
    Seems you are having some problem.
    The entire scenario goes lyk this. Do the process in the same sequence
    <b>1st source sender</b>
    Data type (1)
    Message type(1)
    Outbound message interface (category outbound, mode asynchronous)(1)
    <b>Abstract</b> message interface (category abstract, mode asynchronous) (1)
    <b>2nd source sender</b>
    Data type (1)
    Message type(1)
    Outbound message interface (category outbound, mode asynchronous)(1)
    <b>** Copy the message type to the 1st source</b>
    <b>Receiver / target</b>
    Data type (1)
    Message type(1)
    Outbound message interface (category outbound, mode asynchronous)(1)
    <b>** Copy the message type to the 1st source.</b>
    Back to <b>1st</b> source system
    Abstract message interface (category abstract, mode asynchronous) (1)
    <b>**<b>refering</b> to 2nd source message type that was copied to the first source.</b>
    Abstract message interface (category abstract, mode asynchronous) (1)
    <b>**refering to target message type that was copied to the 1st cource</b>Now totally you will have <b>3 abstract interfaces</b> in the <b>1st source system</b>.
    Define <b>message mapping (n:1)</b> in the 1st source system. ( <b>between 1source message typ + 2nd copied source message type to target )</b>
    Define <b>1 interface mapping</b> and specify the message mapping program. (2 source interfaces -> 1 target interface)
    <b>Bpm</b>
    <b>start -> rec 1 -> rec 2 -> transformation step -> send -> stop</b>
    <b>rec1</b> -> refers to 1st source abstract interface
    <b>rec2</b> -> refers to 2nd source abstract interface
    <b>send</b> -> refers to target abstract interface
    Give it a try. Any issues post bak
    Cheers,
    *RAJ*

Maybe you are looking for

  • JSDS 6.2 and Solaris 10 UNIX Accounts (simple,proxy)

    Hi, I just got my Solaris10 server-client setup working. Here's some items that may be useful to you: All I'm using LDAP for at this point is user authentication to include home directory management from the server ( NFS share and auto_fs setup in LD

  • Purchase Requisition from CRM Service Order

    Hello Everybody, I am trying to create Purchase requisition from Service Order for Service(Material type DIEN) as well as Material (Material type HAWA). I have maintained all the necessary configuration in CRM as well as ECC, like in CRM,  Logistic i

  • Need help with Java MIDI and VST info

    I am currently a college student for programming and I know programming very well, but for this current task, I am completely stuck. This is not a school project or work, just a personal project I'm working on at the moment to learn more about Java.

  • Event scriptions created on standard business events not firing

    We have created a subscription and written custom code in the standard business event oracle.apps.eam.workorder.created . It should fire after a work order is created, but somehow our code is not getting executed. Tried with phase <100 and >=100 Is t

  • Where are the Dreamweaver CS5 "assets" folders?

    I've had to clean reinstall Mavericks and am trying to find the assets (mainly snippet blocks of code to frequently reuse in website entries).  I can't seem to find them in my Time Machine backup.  What are the files named and where in what part of t