请教各位大虾,
1、在结构中能不能定义一个引用? for example,
typedef struct tatITEM
{
int nItemID;
CString& szItemContent;
}ITEM; CArray<ITEM,ITEM> m_ArrayItem;
在编译的时候会出现错误,
error C2512: 'tagITEM' : no appropriate default constructor available
f:\visual studio_win2k\vc98\mfc\include\afxtempl.h(331) : see reference to function template instantiation 'void __stdcall ConstructElements(struct tagITEMOUTPUT *,int)' being compiled2.如果上述的引用改成指针,CString* pszItemContent;
在vc编程中,好像CStirng*看到的比较少,因此想了解一下
如果用CStirng*,在编程中应该注意哪些内容?
1、在结构中能不能定义一个引用? for example,
typedef struct tatITEM
{
int nItemID;
CString& szItemContent;
}ITEM; CArray<ITEM,ITEM> m_ArrayItem;
在编译的时候会出现错误,
error C2512: 'tagITEM' : no appropriate default constructor available
f:\visual studio_win2k\vc98\mfc\include\afxtempl.h(331) : see reference to function template instantiation 'void __stdcall ConstructElements(struct tagITEMOUTPUT *,int)' being compiled2.如果上述的引用改成指针,CString* pszItemContent;
在vc编程中,好像CStirng*看到的比较少,因此想了解一下
如果用CStirng*,在编程中应该注意哪些内容?
節省空間?如果想用數組的話有CStringArray啊。
typedef struct tatITEM
{
int nItemID;
CString szItemContent; !!!!!!!!!!!!! not CString&
}ITEM;