release 0.91

This commit is contained in:
Marc Wäckerlin
2004-04-27 20:26:50 +00:00
parent 93696ef645
commit eb6daf08ba
13 changed files with 1111 additions and 49 deletions

View File

@@ -0,0 +1,25 @@
#include <mrw/smartpointer.hpp>
class A {
public: int a;
protected: virtual void fn() {} // dynamic_cast requires a virtual function
};
class B: virtual public A {
public: int b;
};
int main(int, char**) {
utl::SmartPointer<int> i1 = new int;
*i1 = 13;
utl::SmartPointer<int> i2 = i1;
utl::SmartPointer<int> i3;
if (!i3) i3 = i2;
*i2 = 666; // *i1 is now 666 too
utl::SmartPointer<A> b1 = new B;
utl::SmartPointer<B> b2 = b1; // b1 and b2 point to the same instance
b1->a = 0; // b1->b does not compile
b2->a = 1;
b2->b = 2;
return 0;
} // memory is automatically freed