I want to create classes Car, Vehicle, and Airplane with the following properties:
- Car and Airplane are both subclasses of Vehicle.
- Car and Airplane both have an initWithString method.
- The acceptable input strings for Car's and Airplane's initWithString methods do not overlap.
- Vehicle is "almost abstract", in the sense that any initialized instance should be either a Car or an Airplane.
- It is possible to pass a string into Vehicle and get back an instance of Car, an instance of Airplane, or nil, depending on the input string.
Any particular design pattern I should prefer? In particular for Vehicle's initWithString and/or newVehicleWithString methods.