Hey all,

I ran into a bit of an issue using Qt with nested C++ classes. Namely, moc doesn't support nested classes, and I need to restructure some of my code to reflect this.

Since friend classes and nested classes are pretty similar I wanted to convert my nested classes into friend classes. The problem is that my "outer" nested classes often have enums or structs that are accessible to the "inner" nested classes. I don't quite get how to access these typedefs using friend classes without making them global.

ex:
Qt Code:
  1. class Temp
  2. {
  3. friend class FriendOfTemp;
  4. public:
  5. struct infoRow
  6. {
  7. int blah;
  8. int blah2;
  9. };
  10.  
  11. enum osTypes
  12. { win, osx, linux, unix, beos, qnx};
  13. };
  14.  
  15. class FriendOfTemp
  16. { ... };
  17.  
  18. FriendOfTemp::FriendOfTemp
  19. {
  20. os_type = linux // wouldn't make sense
  21. infoRow newRow; // wouldn't work
  22. }
To copy to clipboard, switch view to plain text mode 

How would I go about doing this?