Click here to Skip to main content
16,012,223 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating a .docx file programatically? Pin
Cedric Moonen30-May-08 6:05
Cedric Moonen30-May-08 6:05 
GeneralRe: Creating a .docx file programatically? Pin
led mike30-May-08 6:13
led mike30-May-08 6:13 
AnswerRe: Creating a .docx file programatically? Pin
led mike30-May-08 6:13
led mike30-May-08 6:13 
AnswerRe: Creating a .docx file programatically? Pin
David Crow30-May-08 7:56
David Crow30-May-08 7:56 
QuestionError with CArray, CMap Pin
Trupti Mehta30-May-08 4:44
Trupti Mehta30-May-08 4:44 
QuestionRe: Error with CArray, CMap Pin
David Crow30-May-08 4:59
David Crow30-May-08 4:59 
AnswerRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 5:52
Jijo.Raj30-May-08 5:52 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta30-May-08 22:41
Trupti Mehta30-May-08 22:41 
Yes you are absolutely correct, DeptDetails is derived from CObject & IMPLEMENT_SERIAL(DeptDetails, CObject, 1);
is added as expected.
Thanks for your help.

Based on your link, I added both constructor/method :
public:
	DeptDetails(const DeptDetails &d);	// Copy Constructor
	DeptDetails& operator=(const DeptDetails &d);	// Assignment operator

And implemented as :
 // Copy Constructor
DeptDetails::DeptDetails(const DeptDetails &d) {
	deptNo = d.deptNo;
	deptName = d.deptName;
	vat = d.vat;
}

// Assignment operator
DeptDetails& operator=(const DeptDetails &d) {
	deptNo = d.GetDeptNo();
	deptName = d.GetDeptName();
	vat = d.GetVat();
	
	return *this;
}


Copy constructor is perfect, but operator assignment gives 8 error :
eptDetails.cpp
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(28) : error C2801: 'operator =' must be a <Unknown> member
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(29) : error C2065: 'deptNo' : undeclared identifier
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(29) : error C2662: 'GetDeptNo' : cannot convert 'this' pointer from 'const class DeptDetails' to 'class DeptDetails &'
Conversion loses qualifiers
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(30) : error C2065: 'deptName' : undeclared identifier
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(30) : error C2662: 'GetDeptName' : cannot convert 'this' pointer from 'const class DeptDetails' to 'class DeptDetails &'
Conversion loses qualifiers
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(31) : error C2065: 'vat' : undeclared identifier
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(31) : error C2662: 'GetVat' : cannot convert 'this' pointer from 'const class DeptDetails' to 'class DeptDetails &'
Conversion loses qualifiers
D:\TRUPTI\HANDHELD\MC_App\DeptDetails.cpp(33) : error C2673: '=' : global functions do not have 'this' pointers
Error executing clarm.exe.

DeptDetails.obj - 8 error(s), 0 warning(s)

I tried a lot, and understand that their is a simple minute mistake which is causing so many errors, but couldn't trap the mistake.

Can please help me know the mistake and resolve the errors.

I appreciate your help.

Thanks

Terry

GeneralRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 23:16
Jijo.Raj30-May-08 23:16 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta31-May-08 0:38
Trupti Mehta31-May-08 0:38 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj31-May-08 6:28
Jijo.Raj31-May-08 6:28 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 0:05
Trupti Mehta1-Jun-08 0:05 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 1:59
Jijo.Raj1-Jun-08 1:59 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 8:57
Trupti Mehta1-Jun-08 8:57 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 23:11
Jijo.Raj1-Jun-08 23:11 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta2-Jun-08 2:09
Trupti Mehta2-Jun-08 2:09 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj2-Jun-08 4:27
Jijo.Raj2-Jun-08 4:27 
QuestionCannot run the exe of my application Pin
vijay_aroli30-May-08 2:55
vijay_aroli30-May-08 2:55 
QuestionRe: Cannot run the exe of my application Pin
David Crow30-May-08 3:15
David Crow30-May-08 3:15 
AnswerRe: Cannot run the exe of my application Pin
Mike Dimmick30-May-08 7:16
Mike Dimmick30-May-08 7:16 
QuestionHow to remove a folder and all its contents Pin
piul30-May-08 0:25
piul30-May-08 0:25 
QuestionRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:32
mveCPallini30-May-08 0:32 
AnswerRe: How to remove a folder and all its contents Pin
piul30-May-08 0:44
piul30-May-08 0:44 
GeneralRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:59
mveCPallini30-May-08 0:59 
GeneralRe: How to remove a folder and all its contents Pin
piul30-May-08 1:05
piul30-May-08 1:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.