#include <iostream>
using std::cout;
using std::endl;
class Test {
int n;
public:
Test();
void Set(int _n);
void Print();
~Test();
};
Test::Test() {
cout << "Test()" << endl;
n = 100;
}
void Test::Set(int _n) {
n = _n;
}
void Test::Print() {
cout << n << endl;
}
Test::~Test() {
cout << "~Test()" << endl;
}
void Function(Test *o);
int main()
{
Test o;
o.Print();
Function(&o);
o.Print();
return 0;
}
void Function(Test *o) {
cout << "Function(Test *o)" << endl;
o->Set(999);
}
/*
run:
Test()
100
Function(Test *o)
999
~Test()
*/