Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Object.h"
- // The ObjectTest class inherits the universal-base-class Object
- class ObjectTest : OBJECT
- {
- // OBJECT_THIS makes Ref, ConstRef, WeakRef, and ConstRef for shared_pointers
- // and adds This() and WeakThis() methods that return shared pointers
- OBJECT_THIS(ObjectTest);
- public:
- ObjectTest(int)
- {
- //It's now OK to get a shared pointer in a constructor!!!
- This();
- }
- };
- //ObjectTest::Ref is a shared pointer
- ObjectTest::Ref test = OBJECT_NEW ObjectTest(5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement