we can design a base class which will base for any element to be stored on the shelf bringing in inheritence. Shelf is a separate class having fields to identify allowable types that can be stored on the shelf. Shelf class can contain any collections to allow adding and removing objects from it.
abstract class Base{
.........
}
class Book extends Base implements PrintedMediumInt{
....................
}
Class DVD extends Base implements ElectronicMedia{
....................
}
class Shelf{
ArrayList <Base> collection;
}
Inheritence is used for object creation and shelf uses composition. In addtion object creation can be done via abstract factory. Further extension for CD/DVD/Blueray can be achieved using decorators.