TMX Group interview question

here a simple string class and how would you improve it ?

Interview Answer

Anonymous

2 Jan 2023

I said: use std::string then they said: «yeah, we should do that» but we are stuck with our string class. So i Looked at the class and: - it was doing malloc (strdup) in ctor, but delete in dtor. - was missing assignment operator - had a off by one error in one of the member - many errors likes that: very simple to find & fix