lxg

导航

 

引自:https://blog.csdn.net/y1196645376/article/details/51455273

 

 

 

 

 

 

//测试

#pragma once
#include "Reflex.h"
#include "Object.h"

class A : public Object
{
DECLARE_CLASS(A)
public:
A();
~A();
};

//----------------------------------------------------

class B : public Object
{
DECLARE_CLASS(B)
public:
B();
~B();
};

#include "A.h"
#include <iostream>
using namespace std;

IMPLEMENT_CLASS(A);
A::A()
{
cout << "A Constructor!" << endl;
}


A::~A()
{
cout << "A Destructor!" << endl;
}

//-------------------------------------------------------

IMPLEMENT_CLASS(B);
B::B()
{
cout << "B Constructor!" << endl;
}


B::~B()
{
cout << "B Destructor!" << endl;
}

//--------------------------------------------------

#include "Object.h"

void main()
{
Object* objA = Object::CreateObject("A");
Object* objB = Object::CreateObject("B");

delete objA;
delete objB;

getchar();
}

posted on 2021-07-26 16:11  lxg_7105  阅读(76)  评论(0编辑  收藏  举报