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

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

 

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;

posted @ 2018-06-20 15:30  鬼谷子com  阅读(213)  评论(0编辑  收藏  举报