D
Dominique
Hi
Can anyone help here. I have defined a copy constructor:
CString::CString (const CString &string) // copy constructor
{
Int16 size = string.GetLength() + 1; // this line generates error
....
}
and the GetLength member:
Int16 CString::GetLength()
{
....
}
The error on the marked line is:
const CString as 'this' argument of 'Int16 CString::GetLength()' discards
qualifiers
I am using the GCC compiler, and I assume the 'const' is the source of the
problem, but everywhere I look, the copy constructor seems to be defined
correctly.
Is this a problem in the compiler, or have I made an error?
Thanks
Dominique
Can anyone help here. I have defined a copy constructor:
CString::CString (const CString &string) // copy constructor
{
Int16 size = string.GetLength() + 1; // this line generates error
....
}
and the GetLength member:
Int16 CString::GetLength()
{
....
}
The error on the marked line is:
const CString as 'this' argument of 'Int16 CString::GetLength()' discards
qualifiers
I am using the GCC compiler, and I assume the 'const' is the source of the
problem, but everywhere I look, the copy constructor seems to be defined
correctly.
Is this a problem in the compiler, or have I made an error?
Thanks
Dominique