Friday, April 8, 2005 01:04 AM
An abstract class can have some methods implemented, some not. It is used to implement the "template method pattern" (read E.Gamma's et.al. book on Design Patterns - it's hard, but necessary for a professional!).
In Java, another class can only have one superclass, therefore "mixing the functionality of a few abstract classes" (the C++ "mixin pattern") is not possible - see problem/example below.
An interface is just a "promise" to implement some methods. As you can give more than one promise at the same time, a class can also implement many interfaces (sometimes this is called "multiple inheritance of interfaces" - but this is actually a *wrong* name, because there is no "inheritance" when a class implements the methods of an interface).
Ok, that was the theory. I tried to write a convincing example - but it's much work. So my advice is: Read read read read read books explaining this; and write write write (design design design) programs and have them corrected by someone who knows about all this.
Remember: Learning without a skilled teacher is usually useless.