引自: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();
}