U E D R , A S I H C RSS

TheWarOfGenesis2R/Temp (rev. 1.1)

The War Of Genesis2R/Temp

#include <boost/shared_ptr.hpp>
#include <vector>
#include <iostream>
using namespace boost;
using namespace std;

class Test
{
private:
	int a;
	int b;
public:
	void Show() 
	{
		cout << a << b << endl;
	}
	Test(int a1, int b1)
	{
		a = a1;
		b = b1;
	}
	~Test()
	{
		cout << a << b << "destroy \n";
	}
};	

typedef shared_ptr<Test> TestPtr;

int main()
{
	vector<TestPtr> con;

	TestPtr test1( new Test(1,2) );
	TestPtr test2( new Test(3,4) );
	TestPtr test3( new Test(5,6) );
	TestPtr test4( new Test(7,8) );

	con.push_back(test1);
	con.push_back(test2);
	con.push_back(test3);
	con.push_back(test4);
	
	for(int i = 0 ; i < con.size() ; ++i)
		con[i]->Show();

	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:13
Processing time 0.0176 sec