I have a base class that has an enum value that I am using in the derived class. The base class is a Table<>
and the derived class is a Matrix<>
. Now the enum value in Table<>
is TABLE_SIZE
which is used in the Matrix<>
class. Since TABLE_SIZE
does not make a lot of sense (it does a little!) in the matrix class, I thought I would typedef it to something more consistent with Matrix<>
(MATRIX_SIZE
).
typedef TABLE_SIZE MATRIX_SIZE;
That didn't work, which was a bit surprising. I am guessing I can't typedef the value because the enumeration is a type but not the values (not sure if that is a correct observation)?. So, now the question is, how-do-I/can-I accomplish the above?
EDIT: One thing I forgot to mention is that I do not want the Matrix class to increase in size (yes I realize it is a tiny increase and wouldn't matter for most people, in my case, it does).
You can define an enumeration: enum { MATRIX_SIZE = TABLE_SIZE };