hi, I am writing code for output data from a BST node. the node is a Client class consist of ID, name and address. when the searching ID is matched, then the data of the client is printed. there is a operator=() overloading in the BST header file, like this:
class client {
public:
...
void operator=(client const &);
..
char *GetName() { return Name;}
char *GetPhone() {return Phone;}
int GetID(){ return ID;}
...
private:
char *Name;
char *Phone;
int ID;
};
void client:perator=(cleint const &person)
{
Name=person.GetName();
Phone=person.GetPhone();
ID=person.GetID();
}
I also tried in this way:
void client:perator=(cleint const &person)
{
strcpy( Name, person.GetName()) ;
strcpy( Phone, person.GetPhone());
ID=person.GetID();
}
but when I compile the code there is always an error message:
error C2662: 'GetName' : cannot convert 'this' pointer from 'const class client' to 'class client &'
.
what goes wrong with the code? I use VC++, could some one help me to figure out the problem?
thanks in advance!