#ifndef TOYPTR_H_ #define TOYPTR_H_ template class ToyPtr { public: // Constructor that accepts the ptr. explicit ToyPtr(T *ptr) : ptr_(ptr) { } // Destructor that deletes the ptr. ~ToyPtr() { delete ptr_; } // Implement the "*" operator T &operator*() { return *ptr_; } // Implement the "->" operator T *operator->() { return ptr_; } private: // The pointer itself. T *ptr_; }; #endif // TOYPTR_H_