*I only included relvant code*Code:void cSTRING::operator=(const cSTRING& str) { if (pszString) delete[] pszString; nLen=str.Length(); pszString=new char [nLen+1]; myStringCopy(pszString, str.getString()); } void main() { cSTRING* pString; cSTRING* pPal; pString = new cSTRING("This is my string"); pPal = new cSTRING("bacon, no Cab"); pString=pPal; pString->Display(); delete pString; delete pPal; }
When I try to compile this I get these errors:
c:\documents and settings\joe\my documents\college.lvl.2\cst8132\lab5\cstring.cpp(1 59) : error C2662: 'Length' : cannot convert 'this' pointer from 'const class cSTRING' to 'class cSTRING &'
Conversion loses qualifiers
c:\documents and settings\joe\my documents\college.lvl.2\cst8132\lab5\cstring.cpp(1 61) : error C2662: 'getString' : cannot convert 'this' pointer from 'const class cSTRING' to 'class cSTRING &'
Conversion loses qualifiers
Whats the problem with this?
Thanks



LinkBack URL
About LinkBacks


