Help with overload=(char*) member function

My main calls this function using S4 = "Test". When these values are passed to the following member function the char value "Test" is not set to s4. Any ideas. This is for a homemade string class driver program. The snippet of the main used to call this member function and the String member function is below. Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
  cout << "\nTesting the function which overloads the char* assignment operator=" << endl;
	cout << "For example, copy char 'Test' into string 4" << endl;
	S4 = "Test";
	cout << "String 4 now carries the string " << S4 << endl;

   String1 String1::operator=(char *bufferString)
{
	String1 temp(bufferString);
	strcpy(temp.str, bufferString);
	cout << bufferString; //Test to make sure operator= was taking buffer string
	return temp;
}
Topic archived. No new replies allowed.