CArrays& CArrays::operator =(CArrays &src)
{
if (this!=&src)
{
this->m_year=src.m_year;
}
return *this;
}
CArray <CArrays,CArrays&> strArray;//类必须有无参构造函数 第一个为指针则第二个也为指针
strArray.SetSize(10);
CArrays arr1(1);
CArrays arr2(2);
strArray[0]=arr1;
strArray[1]=arr2;
strArray.GetUpperBound()
while(strArray.GetUpperBound()>-1)//new 的对象
{
strArray.RemoveAt(0);
}
strArray.RemoveAll();//一般对象
CList <CArrays,CArrays&> strList;//
CArrays arr1(1);
CArrays arr2(2);
strList.AddTail(arr1);
strList.AddTail(arr2);
for (POSITION pos=strList.GetHeadPosition();pos;)
{
CArrays arr= strList.GetNext(pos);//strList.GetNext(pos);
CString str;
str.Format(L"%d",arr.m_year);
MessageBox(str);
}
strList.RemoveAll();
if(strList.IsEmpty())//指针对象时
{
strList.RemoveHead();
}
CMap<CString,LPCSTR,CArrays,CArrays&> myMap;//键键值值.