namespace sys
{
class Object
{
public:
class Type : public sys::Type { };
Object(const Type* type);
protected:
const Type* _type;
};
/* other classes here */
class Type : public Object
{
public:
class Type : public sys::Type { };
Type(
const Type* metatype,
const String* name,
const Type* base,
/* and more parameters */
);
protected:
const String* _name;
const Type* _base;
/* and more members */
};
}
#define typeof(T) (T)::Type
As you can see, I'm basically trying to create my own virtual machine / runtime. I started working on this in C with lots of macros, but it is getting ugly quickly and I really like the idea of C++ namespaces, so I'm starting to re-write it in C++. Is what I'm trying to do with the nested types possible?