• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Real World examples of interface and abstract class

 
Ranch Hand
Posts: 77
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know the difference between the two, the problem is that I am not able to relate them to any real world scenarios.
I have googled this question a lot and found some related posts on the ranch but none provided to the point answers.
It would be helpful if any fellow ranchers can provide real world examples.

P.S. (The Simpler, The Better )

Thanks,
Shivom Shukla
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Real world examples?
Check out MouseListener and MouseAdapter
 
Marshal
Posts: 79153
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
List and AbstractList?
 
Shivom Shukla
Ranch Hand
Posts: 77
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Thank You for your replies, but by real world example I meant can you make up your own example of (like a building's blueprint is an interface,that kind of) interface and abstract class.
Examples that relate to our real world scenarios.

Thanks,
Shivom
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe if you can tell us what part you are struggling with, we can help you better
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Engine and Tree?
 
Shivom Shukla
Ranch Hand
Posts: 77
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneesh and Campbell,

I am looking for examples which say like,
a building blueprint is an example of an interface and like a mobile phone is a type of an abstract class.(These might be wrong, just giving an example).
Not any example in code.(Though Campbell's example is pretty impressive )
I was asked a question to give some common real life example of interfaces and abstract classes with no relation to code, just real world examples.

Thanks,
Shivom
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
t is difficult to find a real “interface” in real life. You can say that a radio has an interface like thisSome radios have knobs, some push-buttons and some sliders for tuning. But you do not usually see interfaces, nor classes in real life. In real life, if you walk into something, it is an object.
 
Shivom Shukla
Ranch Hand
Posts: 77
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thank You,
It has been a real help.

Regards,
Shivom
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe to understand this better you need to understand first difference between inheritance and interfaces. Inheritance is always is-a relationship, while interface is always has-a relationship.Relationship between vehicle and car is is-a relationship, but relationship between car and navigation facility is has-a relationship. Cars may or may not have it.Abstract class comes under inheritence, which should be is-a relation ship. When you say vehicle, its a abstract, but car which is sub-class of vehicle which is a real thing.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic