typedef which can be inherited, but isn't available from inside

Dec 13, 2011 at 11:20am
I've tried to sort this out before, but came back with the
following example:

1
2
3
4
5
6
7
8
9
10
11
// CAN later access from outside an inherited typedef
template <int N>
struct tdBase { typedef int Xtype; };
template <int N>
struct tdDeri: public tdBase<N>
{
   // BUT
   //Xtype xx = 112; // not declared!
};

const tdDeri<0>::Xtype i = 123;

Why can't it compile?:
Xtype xx = 112;
Dec 13, 2011 at 11:26am
You have to write typename tdBase<N>::Xtype xx = 112;
Dec 13, 2011 at 8:28pm
I know that. What I desire to read is an explanation of the reasons
why C++ is in that way... Seem like a flaw...
Dec 13, 2011 at 8:34pm
Topic archived. No new replies allowed.