B
Brett Irving
Hi could someone please help me on this cause I keep having problems
with it
I want to be able to assign one object to another but everytime I do
so it keeps segfaulting on me, Ive tried about 10 different ways of
trying to get this right and it just wont work
here is my code
I have globals char* name and int bikeReg
cyclist& cyclist:perator=(const cyclist& cyc)
{
if( this != &cyc )
{
delete[] name;
name = new char[strlen(cyc.name)+1]; // get new space
strcpy(name, cyc.name); // copy new name
bikeReg = cyc.bikeReg;
}
return *this;
}
Thanks a lot
with it
I want to be able to assign one object to another but everytime I do
so it keeps segfaulting on me, Ive tried about 10 different ways of
trying to get this right and it just wont work
here is my code
I have globals char* name and int bikeReg
cyclist& cyclist:perator=(const cyclist& cyc)
{
if( this != &cyc )
{
delete[] name;
name = new char[strlen(cyc.name)+1]; // get new space
strcpy(name, cyc.name); // copy new name
bikeReg = cyc.bikeReg;
}
return *this;
}
Thanks a lot