Hi all,
I got the following problem. I have two class templates, one inheriting from the other.
I know that this code is not correct. I've read about the compiler's two-phase lookup of members in template classes. So I assume that giving the fully qualified name would work. But it doesn't: If I replace the
with
the compiler (gcc 4.4.3) complains about this line with
My questions are:
1. Is there any way to use the A class in my B class?
2. I have read that for non-type members of the class template M I can use the "using" declaration inside the child class to be able to use it like its own member. Is there anything I like this for type-members like class A?
I would gratefully appreciate any help.
~<><~~~~~~~ presencia
I got the following problem. I have two class templates, one inheriting from the other.
Code:
template<typename T>
struct M{
class A{};
};
template<typename T>
class B:public M<T>{
A a;
};
Code:
A a;
Code:
M<T>::A a;
Code:
error: ISO C++ forbids declaration of ‘A’ with no type error: expected ‘;’ before ‘a’
1. Is there any way to use the A class in my B class?
2. I have read that for non-type members of the class template M I can use the "using" declaration inside the child class to be able to use it like its own member. Is there anything I like this for type-members like class A?
I would gratefully appreciate any help.
~<><~~~~~~~ presencia
Comment