Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abstract class and interface

 
parag chaudhari
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
can any tell me,
when to use abstract classs and interfaces.
thanks.
parag
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would use an abstract class when you have common methods that any subclass needs to have.
You use interfaces when you do not want the class to do anything, but tell all other classes the methods that they must have in order to be instatiated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic