The CString class supports dynamic character strings. CString objects can grow and shrink automatically, and they can be serialized. Member functions and overloaded operators add Basic-like string-processing capability. These features make CString objects easier to use than C-style fixed-length character arrays. Conversion functions allow CString objects to be used interchangeably with C-style strings. Thus a CString object can be passed to a function that expects a pointer to a constant string (const char*) parameter.
Like other Microsoft Foundation classes, the CString class allocates memory on the heap. You must be sure that CString destructors are called at appropriate times in order to free unneeded memory. There is no automatic “garbage collection” as there is in Basic.