#include <fstream.h>
#include <string.h>
class ShallowString	{
public:
	ShallowString(const char* nstr);
	void debug(ostream& out) const;
protected:
	int len;		//length of the string
	char* buf;	//buffer containing string
	};
typedef ShallowString String;

ShallowString::ShallowString(const char* nstr)	{
	len = strlen(nstr);
	buf = new char[len];
	memcpy(buf,nstr,len);
	}
void ShallowString::debug(ostream& out) const	{
	out << "len=" << dec << len
		 << ", buf=0x" << hex << (long)buf << ",";
	for(int i=0;i<len;i++)	{	out << buf[i];	}
	out << endl;
	}

main()	{
	String s1("Hello World");
	String s2(s1);
	ofstream out("test.dat");
	s1.debug(out);	s2.debug(out);
	}
/****** output *******************
len=11, buf=1238828006,Hello World
len=11, buf=1238828006,Hello World
*********************************/


