Overloading assignment operator

Hi,

I have a simple string class, which is defined below:

class String
{
public:
char* str;
};

I wanted to know if the assignment operator can be overloaded to do the following... (See 6th line in the below function)

Some_Function()
{
.............
char* TestStr;
cString MyString;
TestStr = MyString; // Can this be implemented??
}
Hi.

I have written a working example in my blog which explains what you are looking for. Check out.

http://login2win.blogspot.com/2008/06/c-copy-assignment-operator.html

Hope you find this useful.

Thanks
Topic archived. No new replies allowed.