#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;

class strtype {
	char *p;
	int len;
public:
	strtype(char *ptr);
	~strtype();
	char *get(){return p;}
};

strtype::strtype(char *ptr)
{
	int l = strlen(ptr);
	p = new char[l];
	if (!p) {
		cout << "メモリ割り当てエラー\n";
		exit(1);
	}	
	strcpy(this->p, ptr);
	this->len = l;
}

strtype::~strtype()
{
	cout << "pを解放する。\n";
	delete [] p;
}

void show(strtype &x)
{
	char *s;
	s = x.get();
	cout << s << "\n";
}

int main()
{
	strtype a("Hello"), b("There");
	show(a);
	show(b);
	
	return 0;
}