See Memberwise Assignment and Initialization.
One important part is the following syntax for an "operator="override:
type& type :: operator=( [const | volatile] type& )
Which means that for FunctList the "operator=" override needs to be declared something like:
FunctList& operator=(FunctList &pf);
Also be sure to use "this" in "operator=" overrides as
shown in examples, unless you are sure it is not necessary. So your "operator="
override needs to have assignment statements in the following format:
this->?=a.?;
where "?" is a member variable that needs to be copied. Finally, the
"operator=" override needs to return "*this" as in the
following:
return *this;
So the following are samples of "operator=" functions. The first
one is very basic:
class CSimple {
int m_SomeNumber;
CSimple() {m_SomeNumber=0;}
virtual ~CSimple(){}
CSimple &operator=(const CSimple &Parameter) {
this->m_SomeNumber = Parameter.m_SomeNumber;
return *this;
};
};
This other one has a CList collection member:
class CWithList {
CWithList();
virtual ~CWithList();
int m_SomeNumber;
CString m_Name;
CList <COperation,COperation&> m_SomeList;
CWithList &operator=(const CWithList &Parameter) {
this->m_SomeNumber = Parameter.m_SomeNumber;
this->m_Name = Parameter.m_Name;
this->m_SomeList.RemoveAll();
this->m_SomeList.AddHead(&Parameter.m_SomeList);
return *this;
};
};
Note that if you are using the CArray collection instead of CList, you could
use "Copy" instead of "AddHead".