Listing 1: Header.

template <typename T>
class DynObj {
    public:
        DynObj(T* dao): _dao(dao) {}
       ~DynObj() {delete _dao;}
        // other methods like giveAway() etc
    private: // forbid copy construction and assign
        DynObj(const DynObj&);
        void operator=(const DynObj&);
    private:
        T* _dao; // the DAO we represent
};