Results 1 to 5 of 5

Thread: Use of Adaptor Class while implementing interface

  1. #1
    Join Date
    May 2008
    Posts
    248

    Use of Adaptor Class while implementing interface

    I think all the programming language including the object oriented language use the concept of implementing the interface , but in while implementing an interface , we sometime make use of the adapter class , i do not exactly know why we precisely make use of it , has anyone sort of idea what is the actual purpose of using this adapter class when you implement any interface . Please post back your valuable suggestions.

  2. #2
    Join Date
    May 2009
    Posts
    529

    Re: Use of Adaptor Class while implementing interface

    Since we know that interface only includes the declaration of any method or methods in it , any that wants to access those methods will have to implement that particular interface in order to use that method. Then in that class the methods are defined that is code for their body is written .Previously I used to think that we have to define all the methods of that implemented interface and if I want to use only few methods , We may use the Adaptor class.

  3. #3
    Join Date
    May 2009
    Posts
    640

    Re: Use of Adaptor Class while implementing interface

    An adapter is one of the typical design patterns. It is a class in Java as well that implements an interface with a collection of dummy methods. It lets you quickly implement an interface. It also enables your class carry on to work ever if the essential interface obtains new methods. You can then create a subclass the adapter class and override only the required methods you want. This is the actual use of the Adaptor class , I think you got my point. But in case if you have any doubts , you can post back and ask it .

  4. #4
    Join Date
    May 2009
    Posts
    513

    Re: Use of Adaptor Class while implementing interface

    An adapter is one of the typical design patterns. It is a class in Java as well that implements an interface with a collection of dummy methods. It lets you quickly implement an interface. It also enables your class carry on to work ever if the essential interface obtains new methods. You can then create a subclass the adapter class and override only the required methods you want. This is the actual use of the Adaptor class , I think you got my point. But in case if you have any doubts , you can post back and ask it .

  5. #5
    Join Date
    May 2009
    Posts
    542

    Re: Use of Adaptor Class while implementing interface

    In java programming language, adapter class is utilized toimplement an interface that has a group of dummy functions . A few event listener interfaces need several methods. For instance, WindowListener needs seven methods. usually, you only are concerned regarding one of these methods, windowClosing. If we were to code an nameless inner class to terminate an application, it may appear that he can override to the methods he requires.

Similar Threads

  1. Problem with abstract class and interface
    By Vodka in forum Software Development
    Replies: 5
    Last Post: 08-03-2010, 11:20 AM
  2. Can I extend a java class or interface in a JSP page?
    By Juaquine in forum Software Development
    Replies: 4
    Last Post: 17-02-2010, 08:07 PM
  3. Class, interface errors in my program
    By Balamani in forum Software Development
    Replies: 3
    Last Post: 02-12-2009, 05:26 PM
  4. Abstract class and Interface in .net
    By RogerFielden in forum Software Development
    Replies: 3
    Last Post: 04-05-2009, 06:07 PM
  5. Replies: 4
    Last Post: 02-03-2009, 07:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •