В моем классе я объявил статический Clist variable
следующим образом:
#include<stdio.h>
#include<conio.h>
#include <afxtempl.h>
void otherfunc(CList<int,int> a)
{
}
class A
{
public:
CList<int,int> myvariable;
void myfunc()
{
otherfunc(myvariable);
}
};
int _tmain(int argc, _TCHAR* argv[])
{
A a;
a.myfunc();
getch();
return 0;
}
otherfunc()
не является частью моего класса.
Где я ошибаюсь? Я только что вставил фрагмент кода с проблемой. Я инициировал его, и все работает, за исключением строки, в которой я вызываю otherfunc(). Он не зависит от статического ключевого слова. Даже если я удалю статику, я получаю ту же ошибку.
Отредактировано: вот ошибка, которую я получаю:
C:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h(776) : error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(561) : see declaration of 'CObject::CObject'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\afx.h(532) : see declaration of 'CObject'
1> This diagnostic occurred in the compiler generated function 'CList<TYPE,ARG_TYPE>::CList(const CList<TYPE,ARG_TYPE> &)'
1> with
1> [
1> TYPE=int,
1> ARG_TYPE=int
1> ]