"Inherited" types using CRTP and typedef
        Posted  
        
            by Ken Moynihan
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ken Moynihan
        
        
        
        Published on 2010-05-01T05:09:18Z
        Indexed on 
            2010/05/01
            6:17 UTC
        
        
        Read the original article
        Hit count: 396
        
The following code does not compile. I get an error message: error C2039: 'Asub' : is not a member of 'C'
Can someone help me to understand this?
Tried VS2008 & 2010 compiler.
template <class T>
class B
{
    typedef int Asub;
public:
 void DoSomething(typename T::Asub it)
 {
 }
};
class C : public B<C>
{
public:
 typedef int Asub;
};
class A
{
public:
 typedef int Asub;
};
int _tmain(int argc, _TCHAR* argv[])
{
 C theThing;
 theThing.DoSomething(C::Asub());
 return 0;
}
© Stack Overflow or respective owner