text: #include <iostream>
  #include <memory> // for std::shared_ptr
   
  class Resource
  {
  public:
  	Resource() { std::cout << "Resource acquired\n"; }
  	~Resource() { std::cout << "Resource destroyed\n"; }
  };
   
  int main()
  {
  	// allocate a Resource object and have it owned by std::shared_ptr
  	auto ptr1 = std::make_shared<Resource>();
  	{
  		auto ptr2 = ptr1; // create ptr2 using copy initialization of ptr1
   
  		std::cout << "Killing one shared pointer\n";
  	} // ptr2 goes out of scope here, but nothing happens
   
  	std::cout << "Killing another shared pointer\n";
   
  	return 0;
  } // ptr1 goes out of scope here, and the allocated Resource is destroyed