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.
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.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Dec 05, 2006
Thanks for your explanation in a simple way.that was a grt help.