boost::shared_ptr智能指针

include <boost/shared_ptr.hpp>

using namespace std;

class Student
{
private:
	string name;
public:
	Student(string name) : name(name)
	{
		cout << "Student" << endl;
	}

	~Student()
	{
		cout << "~Student" << endl;
	}
};

int main()
{
    boost::shared_ptr<Student> student(new Student("furong"));
}
Student
~Student
posted @ 2022-04-21 20:03  thomas_blog  阅读(26)  评论(0)    收藏  举报