I'm making tile based engine and I want it to be object oriented. But there's a problem when I want to dynamically create tile objects; every tile class for itself. I have method which reads tile types from map and it should create tile objects accordingly. Something like:

type = map[x][y]
new ["Tile"+type]

If I write...

new Tile0

...it works fine, but then I cannot create different tiles dynamically from map.

How can I pull off this or is there some better way of creating tiles? There isn't any good resources for oop tile based engines, or is it?