Hey, thanks for replying.
First of all, I made some mistakes during writing this code(I was tired, but wanted to ask it anyway). For example, both vectors of Book doesn't have a name. Let's call them m_books and m_shelf.
I was looking for answer like this:
string str = personal.capacity[3].getAuthor();
But now there's a problem, that capacity is private member of Shelf, so you can't access it directly. Also, capacity isn't an array, but rather a size of amonunt of books on the shelf.(it should be maximum amount, but I coded it wrong; doesn't really matter).
So I guess, I should make something like this:
1 2 3 4 5 6 7 8 9
|
//In Shelf class...
Book getBook(int number) { return m_books[number]; }
//in Cabinet class...
Shelf getShelf(int number) { return m_shelf[number]; }
//in main.cpp...
Cabinet personal;
personal.getShelf(2).getBook(2).getAuthor();
|
Will that work?
And to assign, how should I make setters, so creating Cabinet personal i can assign books to it?
@up - this is rather example than working class, it has many bugs, but it was used to show problem.