What's The Problem?
Home ] Up ] [ What's The Problem? ] The Solution ] Why Is That Better? ] Multiple Inheritance ] What is an Interface? ] Nouns vs. Adjectives ] Interface Inheritance ] Marker Interfaces ]

 

 

So, you might say, what's the problem?

What if you wanted to add additional capabilities to the employee classes, such as Persistent, Cloneable, etc.?

You could write an abstract class for each one, and then try to get class Employee to use them all:

package company;

import sortable.Sortable;
import persistent.Persistent;
import cloneable.Cloneable;  // Fictitious!

public class Employee extends Sortable, Persistent, Cloneable
{
    // ...
}

Unfortunately, Java gives you compile-time errors if you try it.

Why?

 

This page was last modified on 02 October, 2007