Solved

Debugging problem. operator+=(const char rhs) crashes.

Posted on 1998-07-17
2
166 Views
Last Modified: 2010-04-01
Thank you trestan.
0
Comment
Question by:TylerRick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1168088
If you wish to award points to a specific expert, please say so in the title!
0
 
LVL 8

Accepted Solution

by:
trestan earned 100 total points
ID: 1168089
Thanks. Do not forget reject the original one. Otherwise you will not get your points back. The follows listed here for memo.
It is depends on how you define the length of the CString, especially in your constructor:
CString::CString(unsigned short len)
{
   itsLen = len+1; //You have declare itsLen.
   itsString = new char[itsLen ];
   for (unsigned short i = 0; i<itsLen; i++)
      itsString[i] = '\0';
}
Then the itsLen will be the actual length of the CString. Later, just itsLen+1 is enough. I think you should also define CString1 += CString2. However, you have known what is a complete set of operators. Good luck.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question