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

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

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;

原文地址:https://www.cnblogs.com/wzxNote/p/9204039.html