I have a beginner question regarding nested classes in c++. There are a lot of information on the internet about this but i still can't get it to work properly without compile errors. I simply want to return the inner class B from a function inside class A.
template<class T>
class A
{
public:
A();
class B
{
public:
B(){};
};
B getB();
};
template<class T>
A<T>::A(){}
template<class T>
B A<T>::getB{return B();}
When i do this i get the error "B does not name a type". I believe the solution is to use typedef class A<T>::B b_class;, but i still end up with the same error.
Thank you!
Aucun commentaire:
Enregistrer un commentaire