I'm reading a C++ tutorial book, and the author says most C++ compilers include a String class library, but even if it does, it is recommended to create your own String class. Unfortunately, the author doesn't state why. Does anyone disagree/agree and why?
I'm using Xcode and the String class that is provided seems fine to me, but then again, I've only been working with it for a few hours, so I wouldn't know the limitations.
Thanks in advance.
Sounds to me like you have an old book.
The C++ standard library includes the std::string
class, and you should be using that instead of inventing your own and fixing bugs that have already been encountered and fixed in a widely used library.
As you are a beginner, yes, you should take a swing at implementing your own as it will teach you quite a bit. Just don't use it in any 'real' project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With