Analogy for abstract classes Abstract classes are peculiar things.  Consider:

public abstract class Shape {
    String name;
    protected Point startPoint;

    public Shape(String name){
        this.name = name;
    }

    public String getName(){
        return name;
    }

    public abstract double getArea();
}


The classic way to explain them is to say that they are like interfaces, but can implement methods.  But explaining this way seems counter to their essential nature, and forces us to devolve into a series of random-factoid comparisons between interfaces and Abstract classes.  (Interestingly, the JavaDoc commits this particular sin.)  At no point in that discussion do we even try to get at the intuitive heart of what abstract classes really are.

On the other hand, classes can also be declared "abstract" even if everything is fully implemented and there are no abstract methods at all, which the programmer can do simply to make sure that the class cannot be instantiated directly.  

This lends itself to a different kind of explanation.  We could say that "Abstract classes represent abstract ideas, so that means that we can't instantiate them, and they can declare methods that must be implemented by child-classes."  But, of course, they can have constructor methods.  This seems mysterious until you realize that they are instantiated during constructor-chaining, so saying that they can't ever be instantiated is really not true.

I can think of no explanation for abstract classes that really gets to their essential nature.  Has anyone else found an elegant way to describe them?
The rules for abstract classes are the same as for other classes, with a few minor differences:


An abstract class may have methods that do not have a body
An abstract class has to be sub-classed, at some level, to a non-abstract class before you can instantiate an object
It is not legal to directly instantiate an object of an abstract class


With an abstract base class that has abstract methods, or methods without bodies, all of those methods must be implemented in the subclass, at some level, before instantiation of an object is allowed.

So, imagine the school's official letterhead. At the top is the school logo, name, address, and maybe their motto. Everyone sending an official letter from the school is supposed to use the same letterhead, and they should use the same style and format as other official letters. Sometimes it's allowed to add to the top, such as when the principal gets to add his name to the letterhead, but others are not supposed to do that. To make it easier for everyone to follow the same format at style, the secretary created a "sample" letter for everyone to use. Still some people just didn't get it right, especially the Athletics Department, who used a totally different letterhead. Finally, to end the problem the principle made one, perfect, letter. Instead of real information, however, he used place holders. It looks something like this:


The School of Choice        $School of Choice$          342-54-87971
15 Our Plaza, NE      $Best Students &amp; Best Teachers$   342-54-87915 fax
Best Town, Milan              $Better Grades$           @school_of_choice

From: {your name here}                                     {today's date}

TO: {name of recipient}
    {address of recipient}
    {address line 2}

Subject: {subject goes here}


{your letter goes here

Mauris ut mattis dolor. Donec mollis arcu a augue varius, eu pharetra
ante gravida. Sed ut posuere mi, vitae luctus urna. Vestibulum porta, 
velit quis facilisis hendrerit, nibh magna faucibus urna, a pellentesque
arcu nisi a tortor. Suspendisse nec maximus lorem. Maecenas convallis 
lorem quis neque fringilla, sit amet fermentum justo rutrum. Maecenas.

Vivamus elementum consequat semper. Nullam consectetur nunc quis turpis 
scelerisque pellentesque. Proin blandit, nulla a imperdiet vestibulum, 
odio dui tempor neque, sit amet vehicula magna nibh in tortor. Fusce nec
sapien vitae nibh faucibus hendrerit. Nam fermentum egestas arcu in
vulputate. Proin vulputate metus libero.

}

                                                www.school-of-choice.edu



This "letter" is saved on the school's network where any faculty member can access it, but students cannot. (It wouldn't be right for students to send out "official" letters would it?) The "letter" is also made read only. When a teacher needs to send a note to your parents (oops!) they can Word and load this letter template. They cannot save the template because it's read-only, [it is an abstract letter] but they can save a copy of it with a new name [a subclass of the letter]. Still, if they just printed this, and mailed it, it would look really bad for the teacher [it is still an abstract letter]. In order to make the letter "legal" to send, all the {your name here} type things have to be replaced with real information [replace the abstract methods with real ones]. If the teacher's department has its own web page on the school's site, then it can replace the last line, www.school-of-choice.edu with the full page address www.school-of-choice.edu/comp-sci/ [override a base class method]. Now that everything is replaced it is "legal" to print the letter [instantiate it], and send it to your parents. (Yikes!).