Hmmm, I have seen the exact question before on this forum.
Anyways, first of all I am glad that you have used code tags on your first post.
>>BUT i don't know how I should set the Mem pointer
In the constructor, you should use new operator to assign required memory(determined by the variable called Capacity) to Mem
Mem=new char[capacity];
Then you should perform copy of the char[] argument to the Mem by either strcpy() {needs cstring header file} or by character by character copy.
Copy constructor and operator= can be done in the same way.
Remember to delete[] Mem every time you assign it with a new chunk of memory
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
>>How should I define the Mem pointer so that I can pass it between String objects so I can refer to the same character sequence??
I guess you would be equating the two pointers
Mem=other.Mem; //dont do this
Don't do this. Use strcpy or by character by character copy.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140