#include <stream.h>
#include "Base.h"

void Base::read()
{
  char tag[100];

  cin >> tag;
  if (strcmp(tag, classname()) != 0) {
    cerr << "Unexpected input: " << tag << "\n";
    exit(1);
  }
  readContents();
  cin >> tag;
  if (strcmp(tag, "end") != 0) {
    cerr << "Unexpected input: " << tag << "\n";
    exit(1);
  }
}

void Base::write()
{
  cout << classname() << " ";
  writeContents();
  cout << " end\n";
}
