// File:  ex4-3.cpp

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

class Person
{
  private:
    char* name;
  public:
    Person(const char *);       // constructor
    ~Person();                  // destructor
    void print(void);           // display Person's name
};

Person::Person(const char* n)
{
name = new char[strlen(n)+1];
strcpy(name,n);
}

Person::~Person(void)
{
delete[] name;
}

void Person::print(void)
{
cout << name << endl;
}

int main (void)
{
Person mary("Mary");
Person joe("Joe");
mary.print();
joe.print();
}