Nested dependency-loop classes

I am sorry if this question has been asked before, but I am not sure how to word what I am trying to do. I think the code makes it clear:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  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?
Topic archived. No new replies allowed.