• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interfaces and Abstract Classes  RSS feed

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do we need Interfaces and Abstract Classes when you can as well do the same with either one of them?.

Regards
Thx in advance.
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Interfaces when you know the behaviour but do not know implementation. Use Abstract Clsses when you know some properties, behaviour and may or may not know implementaion.
[ March 07, 2006: Message edited by: KJ Reddy ]
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, a class may implement any number of iterfaces, whilst it can only directly extend one class (which may be the abstract class in question). So interfaces are more flexible in this way...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!