Declaration of struct variables in other class when obtained by getters
Posted
by liaK
on Stack Overflow
See other posts from Stack Overflow
or by liaK
Published on 2010-06-16T13:32:24Z
Indexed on
2010/06/16
13:42 UTC
Read the original article
Hit count: 180
Hi,
I am using Qt 4.5 so do C++. I have a class like this
class CClass1
{
private:
struct stModelDetails
{
QString name;
QString code;
..... // only variables and no functions over here
};
QList<stModelDetails> m_ModelDetailsList;
public:
QList<stModelDetails> getModelDetailsList();
...
};
In this I have functions that will populate the m_ModelDetailsList;
I have another class say CClassStructureUsage
, where I will call the getModelDetailsList()
function. Now my need is that I have to traverse the QList and obtain the name
, code
from each of the stModelDetails
.
Now the problem is even the CClass1's header file is included it is not able to identify the type of stModelDetails in CClassStructureUsage
. When I get the structure list by
QList<stModelDetails> ModelList = obj->getModelInformationList();
it says stModelDetails
: undeclared identifier.
How I can able to fetch the values from the structure? Am I doing anything wrong over here?
© Stack Overflow or respective owner