#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
//#include <cstring>
//#include <string.h>
using namespace std;
class ClassMeta
{
private:
string m_className;
string m_objectName;
public:
ClassMeta(const char* className, const char* objectName): m_className(className), m_objectName(objectName)
{
}
void printMeta()
{
cout << m_className << " [" << m_objectName << "]" << endl;
}
};
#define DEFINE_CLASS(c,n) c n(#c,#n)
class NodeClass : public ClassMeta
{
public:
NodeClass(const char* className, const char* objectName) : ClassMeta(className, objectName)
{
}
};
int main()
{
DEFINE_CLASS(NodeClass,node1);
DEFINE_CLASS(NodeClass,node2);
node1.printMeta();
NodeClass *pNode = &node2;
pNode->printMeta();
pNode = &node1;
pNode->printMeta();
return 0;
}