fart/test/tests.cc
Josh Holtrop c6e1a2c7e4 added refptr<T>::operator=(const T * ptr) method, including refptr in parser
git-svn-id: svn://anubis/fart/trunk@93 7f9b0f55-74a9-4bce-be96-3c2cd072584d
2009-02-10 00:18:07 +00:00

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;
}