stober
April 26th, 2003, 05:23 PM
What is calusing the error shown in [COLOR=red]RED[/red] below? How to fix it?
[code]
class CCellID
{
public:
CCellID() {row = col= 0;}
CCellID(long r,long c) {row = r;col = c;}
CCellID(CCellID& id) {Copy(id);}
void Copy(CCellID& id) {row = id.row; col = id.col;}
void operator=(CCellID& id) {row = id.row; col = id.col;}
int operator==(CCellID& id) {return (row == id.row && col == id.col) ? TRUE : FALSE;}
protected:
long row,col;
};
class A
{
public:
CCellID GetCell() {return m_cell;}
[COLOR=red]error C2652: 'CCellID' : illegal copy constructor: first parameter must not be a 'CCellID'[/red]
protected:
CCellID m_cell;
}
[code]
class CCellID
{
public:
CCellID() {row = col= 0;}
CCellID(long r,long c) {row = r;col = c;}
CCellID(CCellID& id) {Copy(id);}
void Copy(CCellID& id) {row = id.row; col = id.col;}
void operator=(CCellID& id) {row = id.row; col = id.col;}
int operator==(CCellID& id) {return (row == id.row && col == id.col) ? TRUE : FALSE;}
protected:
long row,col;
};
class A
{
public:
CCellID GetCell() {return m_cell;}
[COLOR=red]error C2652: 'CCellID' : illegal copy constructor: first parameter must not be a 'CCellID'[/red]
protected:
CCellID m_cell;
}