Hi! Is it possible to have virtual variables in a class (they would be stored in the v-table)? Or virtual constants? I know that I could just have a virtual function that returned the variable, but it feels bad to have a function to return the variable when I could just have a variable (if the language would support it!). 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.



LinkBack URL
About LinkBacks




Simple and clean solution. I guess this is how you can do it in C if you want to have something close to virtual functions, isn't it?
CornedBee