Source of magicFunction.cpp


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: void magicFunction()
  5: {
  6: // std::shared_ptr<MagicBox<std::string>>
  7: // myMagicPtr(new MagicBox<std::string>());
  8:    auto myMagicPtr = std::make_shared<MagicBox<std::string>>();
  9:    std::cout << myMagicPtr–>getItem() << std::endl;
 10:    // The MagicBox object will be deleted automatically when
 11:    // myMagicPtr goes out of scope.
 12: } // end magicFunction