2024-11-20 02:47:51 +08:00
|
|
|
#include<iostream>
|
2025-04-23 00:24:10 +08:00
|
|
|
#include<hgl/type/object/Object.h>
|
2024-11-20 02:47:51 +08:00
|
|
|
|
|
|
|
using namespace hgl;
|
2025-04-23 00:24:10 +08:00
|
|
|
using namespace std;
|
2024-11-20 02:47:51 +08:00
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
void out(const char *name,Object *obj)
|
2024-11-20 02:47:51 +08:00
|
|
|
{
|
2025-04-23 00:24:10 +08:00
|
|
|
cout<<name<<" static "<<obj->GetTypeName()<<": "<<std::hex<<obj->GetTypeHash()<<endl;
|
|
|
|
}
|
2024-11-20 02:47:51 +08:00
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
class TestObject:public Object
|
2024-11-20 02:47:51 +08:00
|
|
|
{
|
2025-04-23 00:24:10 +08:00
|
|
|
HGL_OBJECT_BODY(TestObject)
|
2024-11-20 02:47:51 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
HGL_OBJECT_CONSTRUCT(TestObject)
|
2024-11-20 02:47:51 +08:00
|
|
|
};
|
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
class TestObjectA:public TestObject
|
2024-11-20 02:47:51 +08:00
|
|
|
{
|
2025-04-23 00:24:10 +08:00
|
|
|
HGL_OBJECT_BODY(TestObjectA)
|
2024-11-20 02:47:51 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
HGL_OBJECT_CONSTRUCT_SC(TestObjectA,TestObject)
|
|
|
|
|
2024-11-20 02:47:51 +08:00
|
|
|
};
|
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
int main(int,char **)
|
2024-11-20 02:47:51 +08:00
|
|
|
{
|
2025-04-23 00:24:10 +08:00
|
|
|
TestObject *to=NewObject(TestObject);
|
|
|
|
TestObjectA *toa=NewObject(TestObjectA);
|
2024-11-20 02:47:51 +08:00
|
|
|
|
2025-04-23 00:24:10 +08:00
|
|
|
out("to",to);
|
|
|
|
out("toa",toa);
|
2024-11-20 02:47:51 +08:00
|
|
|
|
|
|
|
return 0;
|
2025-04-23 00:24:10 +08:00
|
|
|
}
|