38 lines
803 B
C++
38 lines
803 B
C++
|
|
#include <iostream>
|
|
#include <cassert>
|
|
#include "util/Transform.h"
|
|
#include "shapes/Sphere.h"
|
|
#include "util/refptr.h"
|
|
using namespace std;
|
|
|
|
class S
|
|
{
|
|
public:
|
|
S(int val)
|
|
{
|
|
cout << "S constructor, val " << val << endl;
|
|
this->val = val;
|
|
}
|
|
~S() { cout << "S destructor, val " << val << endl; }
|
|
int val;
|
|
};
|
|
|
|
int main()
|
|
{
|
|
S * a = new S(42);
|
|
S * b = new S(33);
|
|
cout << "a: " << a << endl;
|
|
cout << "b: " << b << endl;
|
|
cout << "Creating arp" << endl;
|
|
refptr<S> arp(a);
|
|
cout << "Creating brp" << endl;
|
|
refptr<S> brp(b);
|
|
cout << "Going to assign brp to arp" << endl;
|
|
arp = brp;
|
|
cout << "Going to assign a new S to arp" << endl;
|
|
arp = new S(21);
|
|
cout << "ok, exiting" << endl;
|
|
return 0;
|
|
}
|