#include using namespace std ; class Person { int age; const char* pName; public: Person(): pName(0),age(0) { } Person(const char* pName, int age): pName(pName), age(age) { } ~Person() { cout << "Person Destructor." << endl ; } void Display() { printf("Name = %s Age = %d \n", pName, age); } }; template < typename T > class SP { private: T* pData; // Generic pointer to be stored public: SP(T* pValue) : pData(pValue) { } ~SP() { delete pData; } T& operator* () { return *pData; } T* operator-> () { return pData; } }; int main() { SP< Person > p(new Person("Scott", 25)); p->Display(); // Dont need to delete Person pointer.. return 0 ; }