• 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

Abstract Class & Interface

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers:

I am really confused now between the Abstract Classes and Interfaces. I know that:

- Abstract classes have virtually no use, no value, no purpose of life UNLESS they are extended.
- Interfaces are used to prevent the infamous DDD (Deathly Diamond of Death).

I know somehow what the differences between two of them are, but I just can not describe it for certain (I am just too overloaded with OO polymorphysym information). Can you help me with the diffrences between two of them, and please feel free to whip me up with the correct information if I happened to understand two of them wrongly.

Thanks,
Erik
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interfaces can be considered as a blue print or a design of your class.. if you think that these are the methods going to be wrapped and going to be used in your implemented class then you can go for interfaces. and interfaces are best compared to abstract class in general.

abstract classes, if you know certain concrete defnition of your methods, then you have the facility to define it. and as well unknown can be left as such. but the thing is, only one abstract can be extended by a class. since multiple inheritance is not there in java.

where as interfaces allows you to implement as many interfaces as you wish.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic