Inheritance is a much broader use-case than the Factory pattern. Factory makes use of inheritance to do its job, so its scope is much more narrow than that of inheritance itself. The goal of using a factory method is that the caller doesn't have to know the internal details of the object he wants created. If you have a factory method for "Shape objects" (ie. method returning Shape*) then it means you are not interested in what the shape actually is and you just want to handle it via the Shape interface regardless if it is a Circle, Rectangle or Square. The point of using a factory is that you don't directly tell what class of object you want created. You simply pass some parameters to the factory method and it is the factory method that makes a choice of class based on those parameters.
Consider an abstract example that you want to buy a car but you don't care what brand and model it is going to be as long as it suits your preferences. So you go to the car dealer and tell him that you want a red sedan car with electric mirrors, navigation and parking assistance. The dealer makes a choice for you and sells you ("instantiates") a particular concrete brand, model and version of a car. Then you use the car as any other car, regardless what brand and version of the car this is. You go to your friends and say "Hey, I bought a car today!" and not "Hey I bought a car of brand X, model Y in version Z today!" (in our words, you use it through the Car interface and not through "XYZCar" interface).
If that's a problem for you then maybe you don't want a factory at all. There is a number of other patterns you can employ for different needs.
Bookmarks