I don't think it makes any sense to refer to virtual variables unless they are going to be of different types. Which if they are going to be of different types, it's hard to see how you are going to incorporate that in a meaningful way -- eg, only if you had a function in the base class which operated on the variable which is of one class and you want to change that type in the derived class, which I doubt this will work anyway. Certainly this seems like a non-sequitor:

The reason I'm asking is because I want to index my classes, so that I can easily use the class type as one of two entry keys to a two-dimensional array.
Or maybe I misunderstand you?