Name: Anonymous 2012-11-10 8:49
Is there a better way of going about this? Say we have a house. The house has a bunch of rooms. Each room has a bunch of desks. Each desk has a bunch of drawers. Each drawer has a bunch of folders. And each folder has a bunch of papers.
class Paper{
};
class Folder{
public:
vector<Paper> paper;
};
class Drawer{
public:
vector<Folder> folder;
}
.
.
.
class House{
public:
vector<Room> room
};
//To access the first paper in the first folder in the first drawer in the first desk in the first room of the house:
house.room[0].desk[0].drawer[0].folder[0].paper[0]
It works, but am I going about this the right way?
class Paper{
};
class Folder{
public:
vector<Paper> paper;
};
class Drawer{
public:
vector<Folder> folder;
}
.
.
.
class House{
public:
vector<Room> room
};
//To access the first paper in the first folder in the first drawer in the first desk in the first room of the house:
house.room[0].desk[0].drawer[0].folder[0].paper[0]
It works, but am I going about this the right way?