No multiple inheritance in Java
Interfaces allow the programmer to associate multiple attributes with a given blueprint, such that the user of the blueprint can choose just the one she wants.
An interface looks like this:
public interface Dimensonality {
int getDimensionality ();
}
Using such a declaration we can change the first line of the classes above to look like this:
public class Position implements Dimensonality {
and
public class Position3D extends Position implements Dimensonality {
We can then refer to instances of Position or Position3D like so:
Dimensonality obj = new Position (0, 0);
..so as far as the user is concerned in this usage, it isn't interesting that the object also has specific coordinates.
