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

Abstract classes and interface

 
ashni Prakash
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone explain me the differences between abstract classes and interfaces and how to use them?
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please post questions here that helps others to read and understand and explain. For know how questions, please refer to K&B. Explaining abstract classes and interfaces would atleast take 30 pages of text and we can't explain it here and also you won't benefit from it. READ THE K&B.
 
ashni Prakash
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I am new to discussion board.So still learning to use the discussion board.Will definitely follow the rules.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12199
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an interface is a contract. the interface definition says "if you want to be what i am, you MUST have these methods with these signiatures".

you then have your class implement the interface. you say "i want to be considered one of those, so I am going to have all those methods".

the beauty of all this is that you can change HOW those methods are implemented as often as you like. Since you are still honoring the contract, nobody gets upset and nothing breaks.

an abstract class is a class that is not entirely defined. it's kind of like 1/2 way between an interface and a class. SOME of the methods might be completly defined and implemented, but at least one is not. So when someone extends from an abstract class, they only have to implement the abstract methods, and they get the rest for free.
 
ashni Prakash
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi fred,

Thanks for your explanation in a simple way.that was a grt help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic