This is exactly as I had it explained to me by those nice people at Sun when I did a Java course, what hardburn is describing sounds like an interface, as you say.

The utility of these two when used together correctly is that an Abstract Class provides common behaviours which subclasses will inherit, whereas an Interface merely defines methods which any extending class must implement. In the first case neanderthals and humans both have the same drink() method inherited from the hominids abstract class, which they extend. In the second case, both humans and fish MUST be able to breathe as they both implement the breathers interface but the actual mechanisms used are different.


If this node offends you, re-read it and reconsider. Think for a bit. I am almost certainly not trying to offend you, although I am frequently irreverent or flippant. Rememer - Please never take anything I do or say seriously.

In reply to Re: Re: Abstract Classes by Elgon
in thread Abstract Classes by hardburn

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":