Hi.
Pardon me if this is an obvious one...
Is there a way to get around C++'s refusal to have a class member that's an instance of the class itself...?
What I'd like is:
But what is allowed is:Code:class MyClass { int myClassMember01; struct myStruct { int myStructMember01; MyClass myStructMember02; } myClassMember02; }; // End declaration of MyClass
I am writing a model of a hardware architecture and it'd be conceptually much more realistic if I could use the first of the two above.Code:class MyClass { int myClassMember01; struct myStruct { int myStructMember01; MyClass & myStructMember02; } myClassMember02; }; // End declaration of MyClass
Any suggestions?
Is it in fact true to say that the first example is just conceptually impossible in C++?
Cheers.