Mark, I also have added in the same file (DbOperations.cpp) just copied your code same way. All serialization.desera & template overrride are in the same file. I tried removing template<> & AFXAPI, but still no success. You were very correct that with pointers of Map I will have a problem. To pass the DbOperations reference to other classes, I made a copy constructor & operator=, in this case I can't directly copy map tp map. So I made operatorMap as pointer & the other map deptMap is as a normal object only & not assigning in copy constru or =. deptMap additions & updations are possible (NOT a pointer), but operatorMap (a POINTER) operations are not allowed. It causes Assertion failure in afxtempl.h line 1368 which is Assert 1st line of CMap<> operator[]. I got to take out some solution of this. Can you tell how to assign a map to map in copy constructr & = operator. Basically copy a map to other. In DbOperations .h
typedef CMap<int, int, OperatorDetails, OperatorDetails&> OperatorDetailsMap;
typedef CMap<int, int, DeptDetails, DeptDetails&> DeptDetailsMap;
class ....{
// MAPS
OperatorDetailsMap* operMap;
DeptDetailsMap deptMap;
In .cpp
// Copy Constructor
DbOperations::DbOperations(const DbOperations &d) {
this->operMap = d.operMap;
// this->deptMap = d.deptMap;
}
// = Assignment operator
DbOperations& DbOperations::operator=(const DbOperations &d) {
this->operMap = d.operMap;
// this->deptMap = d.deptMap;
return \*this;
}
/*template <> void AFXAPI SerializeElements <OperatorDetails> (CArchive &ar, OperatorDetails *pOperatorDetails, INT_PTR nCount){
for (int i = 0; i < nCount; i++, pOperatorDetails++) {
pOperatorDetails->Serialize(ar);
}
}*/
My point is how do I copy this.deptMap with d.deptMap, where deptMap being normal objects & not a pointer. With this solution we wont have problem with serializeElements() & pointers. As SerializeElements() causes problems, so looking out for solution without serializeElements & pointers. SerializeElemtsis added only in DbOperations along with WriteArchive & ReadArchive. The same thing is working with Visual Studio, but not with eVC++4. Really it is difficult to code in eVC++ than VC++, many restrictions & uncompatibility. Looking for solution as soon as possible. From days I have been looking for this solution & yet not solved. You have been extremely helpful throughout. I highly appreciate your help and look towards more help. <