#include #include #include using namespace std; //unique_ptr class student { public: int id ; student( int idP ) { id = idP ; cout << "Constructor called for ;" << id << endl ; } student( const student& obj1 ) { id = obj1.id ; cout << "Copy Constructor called for ;" << id << endl ; } ~student( ) { cout << "Destructor called for ;" << id << endl ; } }; void function1( unique_ptr ptr ) { } int main() { std::unique_ptr valuePtr( new student(1) ) ; cout << "Student id:" << (*valuePtr).id << endl ; //Compiler error . Cannot make //function1( valuePtr ) ; //Using the make_unique function std::unique_ptr valuePtr1 = make_unique< student >(2) ; cout << "Student id:" << (*valuePtr1).id << endl ; }