Replymessage unavailable
Factory (as answered before me) not an unusual way to approach this. But your use case that you have presented is an unusual case. What I mean by that is that you would usually not create instances of class in your code that has so many hard-coded values. And if every Apple needs a value that is "Apple", the question arises if it shouldn't be in the class instead of requesting the value on instantiation of the class. Which means that in reality you would probably have a list of objects and possibly a data structure to iterate for the creation of those objects that end up being in a list. Completely eliminating that use case.