Abstract factory implementation added

Source from sourcemaking.com