Listing 3: Class WU_Persistent

/*************************************************************
*****      Quantin' Leap Ltd.                       **********
*            Copyright (c) 2001, All Rights Reserved         *
**************************************************************/

#include <string>
using std::string;

class WU_Persistent
{
public:

  WU_Persistent();
  WU_Persistent(const WU_Persistent &src);
  virtual ~WU_Persistent();

  //operators
  WU_Persistent& operator=(const WU_Persistent &src);

  //accessor method
      string getID() {return m_ID;}
  void setID(string ID) {m_ID = ID;}

  //public interface

  /*! This function should be implemented by the classes 
      inheriting the WU_Persistent interface. It returns a 
      pointer to a WU_Persistent object (an independent clone 
      of the original object)
  */
  //does a deep copy (create a clone)
  virtual WU_Persistent* clone()=0; 

protected:
  /*! the identifying string associated to a WU_Persistent object*/
  string m_ID;
};


//implementation

WU_Persistent::WU_Persistent()
{
  m_ID = "";
}

WU_Persistent::WU_Persistent(const WU_Persistent &src)
{
  m_ID = src.m_ID;
}


WU_Persistent::~WU_Persistent()
{}

WU_Persistent& WU_Persistent::operator=(const WU_Persistent &src)
{
  if( &src != this )
    m_ID = src.m_ID;
  return *this;
}