Category : Files from Magazines
Archive   : CUJ9405.ZIP
Filename : STR.H

 
Output of file : STR.H contained in archive : CUJ9405.ZIP


LISTING 4 - A "copy-on-write" string class design
// str.h: String class with reference counting

#include

class String
{
public:
// Constructors / Destructor
String(const char *s);
String(const String& s);
~String();
// other members omitted...

private:
class Srep
{
public:
Srep(const char*);
~Srep();
char *rep;
size_t count;
};

Srep *rep;
};