Results 1 to 6 of 6

Thread: Interface?

  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    444
    Rep Power
    6

    Default Interface?

    Is interface an alternative way for multiple inheritance?

    Why i am asking this ques is that i have read so in java hand book?

    But i disagree with it.Am i right?
    Mak
    (Living @ Virtual World)

  2. #2
    logicbug's Avatar
    logicbug is offline Member
    Join Date
    Jan 2009
    Location
    The Great White North, eh?
    Posts
    76
    Rep Power
    0

    Default

    It is and it isn't. I waged a holy war on interfaces for awhile because I couldnt find a decent use for them.

    To me they serve two purposes.
    1. control the use of code in projects involving many programmers.

    2. It allows you to create an object of the interface type and pass any object that extends the interface to it.(Which is what it took me a long time to find an exampel there of) It can be very usefull.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    i think that the most practical use for interfaces is to implement the same properties with different classes. examples are the comparable and iterable interfaces.

    there are also personal preferences towards interfaces that i have, but that's just my own quirks when organizing myself.

  5. #5
    arseny is offline Member
    Join Date
    Mar 2009
    Posts
    25
    Rep Power
    0

    Default

    Interfaces is only a workaround which can be used to get an ability to be both entities at the same time. interface or object in java can extend several different interfaces but not objects with theirs methods implementations like in C++.

  6. #6
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default

    Quote Originally Posted by makpandian View Post
    Is interface an alternative way for multiple inheritance?

    Why i am asking this ques is that i have read so in java hand book?

    But i disagree with it.Am i right?
    yes it's write interfaces sre introduced in java to full fill the absence of multiple inheritance. or u can say to remove the ambeguity in method calling from the different classes.

Similar Threads

  1. what is the need of interface?
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 03-13-2009, 10:59 AM
  2. Interface?
    By MarkWilson in forum New To Java
    Replies: 4
    Last Post: 07-11-2008, 09:10 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
  •