|
Top: Basic types: string: Constructors/destructors #include <ptypes.h> string::string(); string::string(const string&); string::string(char); string::string(const char*); string::string(const char*, int); string::~string(); A string object can be constructed in 5 different ways:
Destructor ~string() decrements the reference count for the given string buffer and removes it from the dynamic memory if necessary. Examples: string S1; // empty string string S2 = S1; // copy string S3 = 'A'; // single character string S4 = "ABCabc"; // string literal char* p = "ABCabc"; string S5 = p; // null-terminated string string S6(p, 3); // buffer/length See also: Operators, Typecasts, Manipulation PTypes home |