|
-
January 22nd, 2010, 01:36 PM
#8
Re: What is the problem with the code?
1) As already pointed out, you need to implement the assignment operator
2) you also need to implement the copy constructor
3) the second argument to operator << should be a const reference
4) As also pointed out, operator + does not check if there is enough room
to do the concatenation. And you do not have a way to determine how
much room there actually is. In your example code, s2 will have 1024,
but s1 will only have 3.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|