Use of CList<GroupData *, GroupData *> listname;

354 Views Asked by At

I have written a function

CList<GroupData *,GroupData *> funcationName(CString arg1,CString arg2);

I am connecting to database and adding database results in GroupData Bean class. like this:

GroupData* grpData;
grpData->setGRGRID(groupid);

after that I am adding grpData in CList grpList;

grpList.AddHead(grpData); 

I am getting compilation error

can not access private member of cobject class

in compiler generated file afxtempl.h.

My class have a public constructor.

1

There are 1 best solutions below

0
On

You are trying to return a CList object in your function:

CList funcationName(CString arg1,CString arg2);

I think the best option for you will be to change the function signature like this:

void funcationName(CString arg1, CString arg2, CList<GroupData *,GroupData *> &listData);

Then, you will need to initialise an empty CList in the calling function and pass it as the third parameter to the above function