Reputation: 1633
Class A{
public:
MyVec<A> test; //problem error: ‘MyVec’ does not name a type
};
Class B{
public:
template<typename Obj>
Class MyVec{
//some methods...
};
private:
MyVec<A> test1; //ok
};
Compiler complains about the line where test is defined.
Upvotes: 1
Views: 84
Reputation: 147028
You didn't define or even declare MyVec
before the definition of A. This makes it impossible for the type to be used in A. This is because of the order of declarations.
Upvotes: 2
Reputation: 36986
MyVec
's full name is B::MyVec
. The B::
part is optional when you're inside B
.
Upvotes: 1