Files
mrw-cxx/examples/shared.cxx

31 lines
828 B
C++
Raw Normal View History

/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#include <mrw/shared.hxx>
#include <iostream>
class Test {
public:
Test(int i): _int1(i), _int2(0) {}
Test(int i, int j): _int1(i), _int2(j) {}
int _int1;
int _int2;
};
int main(int, char**) {
mrw::Shared<Test> test1(15);
mrw::Shared<Test> test2(13, 14);
mrw::Shared<Test> test3(new Test(13));
mrw::Shared<Test> test4(test2);
std::cout<<"test1="<<test1->_int1<<", "<<test1->_int2<<std::endl
<<"test2="<<test2->_int1<<", "<<test2->_int2<<std::endl
<<"test3="<<test3->_int1<<", "<<test3->_int2<<std::endl
<<"test4="<<test4->_int1<<", "<<test4->_int2<<std::endl;
return 0;
}