静态成员函数里面不能使用非静态的成员变量

 

static QList<TreeNodeInterface*> GetChildList(NODETYPE nodeType){

if (m_Head->NodeType() == nodeType)
{
return m_Head->ChildList();
}
foreach(TreeNodeInterface* node1, m_Head->ChildList())
{
if (node1->NodeType() == nodeType)
{
return node1->ChildList();
}
foreach(TreeNodeInterface* node2, node1->ChildList())
{
if (node2->NodeType() == nodeType)
{
return node1->ChildList();
}
}
}
return QList<TreeNodeInterface*>();

}

m_Head如果是一个非静态变量,则会报错,指针左侧不是一个class;

相关文章:

  • 2022-01-30
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2018-03-19
相关资源
相似解决方案