我上课
class myClass
{
private:
std::list <myInnerClass> mylists;
class myInnerClass
{
// Design for this private class
}
}
我不明白为什么
std::list <myInnerClass> mylists
行会给我以下错误: - Type 'myInnerClass' was not declared in this scope
- Type 'myInnerClass' could not be resolved
我哪里错了?
最佳答案
在声明它之前,请先使用myInnerClass
。
该代码将编译:
class myClass
{
private:
class myInnerClass
{
// Design for this private class
}
std::list <myInnerClass> mylists;
}