#include <stream.h>
#include <List.h>

class TestObject : public Listable {
public:
  virtual char* classname() { return "TestObject"; }
  virtual IOstatus readContents()  { cin  >> a_; return ok; }
  virtual IOstatus writeContents() { cout << a_; return ok; }
  virtual Listable* duplicate() { return new TestObject(*this); }
private:
  char a_;
};

void testLeak()
{
  List a(new TestObject);
  TestObject b;

  a.read();
  b.read();
  a.add(b);
  b.read();
  a.write();
}
