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:
class Temp
{
friend class FriendOfTemp;
public:
struct infoRow
{
int blah;
int blah2;
};
enum osTypes
{ win, osx, linux, unix, beos, qnx};
};
class FriendOfTemp
{ ... };
FriendOfTemp::FriendOfTemp
{
os_type = linux // wouldn't make sense
infoRow newRow; // wouldn't work
}
class Temp
{
friend class FriendOfTemp;
public:
struct infoRow
{
int blah;
int blah2;
};
enum osTypes
{ win, osx, linux, unix, beos, qnx};
};
class FriendOfTemp
{ ... };
FriendOfTemp::FriendOfTemp
{
os_type = linux // wouldn't make sense
infoRow newRow; // wouldn't work
}
To copy to clipboard, switch view to plain text mode
How would I go about doing this?
Bookmarks