Fix initial implementation and add first test
This commit is contained in:
1 parent
13c7832c4b
commit
b45e664726
2 files changed
+46
-10
No files matched your search
+30
-2
@@ -1,9 +1,22 @@
|
||||
#include <rcp.h>
|
||||
|
||||
static int mybase_construct;
|
||||
static int mybase_destroy;
|
||||
static int myderived_construct;
|
||||
static int myderived_destroy;
|
||||
|
||||
class MyBase : public root
|
||||
{
|
||||
protected:
|
||||
MyBase(int x, int y) {}
|
||||
MyBase(int x, int y)
|
||||
{
|
||||
mybase_construct++;
|
||||
}
|
||||
|
||||
virtual ~MyBase()
|
||||
{
|
||||
mybase_destroy++;
|
||||
}
|
||||
|
||||
public:
|
||||
rcp_managed(MyBase);
|
||||
@@ -12,13 +25,28 @@ public:
|
||||
class MyDerived : public MyBase
|
||||
{
|
||||
protected:
|
||||
MyDerived(double v) : MyBase(1, 2) {}
|
||||
MyDerived(double v) : MyBase(1, 2)
|
||||
{
|
||||
myderived_construct++;
|
||||
}
|
||||
|
||||
virtual ~MyDerived()
|
||||
{
|
||||
myderived_destroy++;
|
||||
}
|
||||
|
||||
public:
|
||||
rcp_managed(MyDerived)
|
||||
};
|
||||
|
||||
void t1()
|
||||
{
|
||||
rcp<MyBase> mybase = MyBase::create(4, 5);
|
||||
rcp<MyDerived> myderived = MyDerived::create(42.5);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
t1();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user