C++boost 智能指针 share_ptr的使用

 


#include "Number.h"
#include <iostream>
#include <stdio.h>
#include "Person.h"
#include <string>
#include <boost/smart_ptr.hpp>
using namespace boost;
using namespace std;

void main()
{

/*CNumber number1(20);
CNumber number2;
number2 = number1;
cout << number2.GetTotal() << endl;*/

char ch = 0;
cout << ch << endl;


boost::shared_ptr<CNumber> pNumber(new CNumber(1000));
pNumber->ShowNumber();


boost::shared_ptr<int> pInt(new int());
*pInt = 40;
cout << *pInt << endl;
int wait ;
cin >> wait;

return ;

}

posted @ 2013-07-01 21:02  Predator  阅读(411)  评论(0编辑  收藏  举报