Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 1.45 KB

cstring-semantics.md

File metadata and controls

29 lines (24 loc) · 1.45 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
CString Semantics | Microsoft Docs
11/04/2016
cpp-windows
reference
C++
semantics in Cstring
CString objects, assignment semantics
assignment statements, assigning CString objects
d4023480-526f-499a-85f6-324b4de5b85f
11
mikeblome
mblome
ghogen

CString Semantics

Even though CString objects are dynamic objects that can grow, they act like built-in primitive types and simple classes. Each CString object represents a unique value. CString objects should be thought of as the actual strings rather than as pointers to strings.

You can assign one CString object to another. However, when you modify one of the two CString objects, the other CString object is not modified, as shown by the following example:

[!code-cppNVC_ATLMFC_Utilities#188]

Note in the example that the two CString objects are considered "equal" because they represent the same character string. The CString class overloads the equality operator (==) to compare two CString objects based on their value (contents) rather than their identity (address).

See Also

Strings (ATL/MFC)