the code wont compile because in the public section it does not yet know about the struct bar. The code works if I just flip the definitions such that the private: section comes before the public: section. But, I was wondering if there is another way to get around this so that I can keep the organization public:, protected:, private:? Thanks!
Ok thank, yeah I tried a few things and couldn't get it to work. I have another similar question. Can I forward declare bar and implement it outside of the class foo? I have tried and it also does not seem to work...something along these lines
you can forward declare bar, but you can use it only as other forward declaration: declaring and moving around pointers and references to that class. To use nested types and member functions, you need to define class itself before use.