C++反射机制()_#pragma

 

 

C++反射机制()_#include_02

 

 

C++反射机制()_#pragma_03

 

 

C++反射机制()_#pragma_04

//测试

#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();

}