I have an array of Tiles[w,h] and by mistake I could (without any obvious errors, so I guess this is okay to do) assign a child object LibraryTile to one of its cells. It shows up as LibraryTile in intellisense hover popup.
I’m not sure if it will not bring any undesired effects, like increased memory consumption (it’s a memberwise copy, not a reference), so I don’t know if I should change my methods or if it is fine to leave them as is.
I assume LibraryTile is a subclass of Tile? Which is why you tagged it as parent-child?
What you’re seeing is just polymorphism. It will “act” like a Tile, just the same. Whether or not it consumes more memory depends on what LibraryTile adds to its base class. You can test at runtime if Tile is an actual LibraryTile and, if so, cast to a LIbraryTile to do “special stuff” so to say. But without more context, I can’t advise you on techniques to take advantage of polymorphism (e.g. virtual methods, interfaces, etc).
If you don’t want to allow inheritance for whatever reason, you can seal your parent class.
http://msdn.microsoft.com/en-us/library/88c54tsw%28v=vs.71%29.aspx