Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's the differnce betwwen abstract class and interface

 
Tan Richards
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
actually I would like to know under what circumstances one should go for abstract class and interface? It's understood when multiple inheritence is required interface must be used. But are ther any other factors that will decide that whether one should make a particular class abstract or use interface. It is being assumed that the class is used for just creating a prototype( I mean the sole purpose of using abstract methods).
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://faq.javaranch.com/view?InterfaceVsAbstractClass
 
Aadi Narayana Reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When u have some default functionality to be placed some where so that the all the subclasses can use the default functionality from its super classes, and they can provide some more info,, in the subclass.

and when u r required to build subclasses which must have their specific behaviour then u can go for interface and implement it with respect to the specific subclass.

aadi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic