Inheritance and arrays

I had a question about how inheritance works. I’m wanting to make an array representing a 2d tile based map. Originally, I had this array simply hold char’s for each coordinate (its for a roguelike). However, I’m realizing it could be very beneficial to instead have each coordinate hold a reference to the object that is positioned there. That way, I could stuff like this
objectMap[12][32].getIsSolid()
to determine if a certain x/y coordinate can be moved to by the player.

But I’m not entirely sure how to do this. My idea was to make all the game objects (players, monsters, walls, etc) inherit a common GameObject type. If so, could I make the array of out GameObject’s and since monsters, players, and walls all inherit game object, set individual cells of the array to any type of game object?

Basically my question comes down to how inheritance works. Basically, can an array of GameObjects only be set to “pure” GameObjects, or can they also be set to any object that inherits GameObjects?