Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Faraz Khalid
4,077 PointsPractice Object Interaction
patron.currentBook.dueDate
How does this access the due date for the currentBook borrowed by the patron when there is no property for dueDate in the patron class?
1 Answer

Zimri Leijen
11,732 PointsdueDate is a key in the currentBook object.
Amir Shahabnia
29,310 PointsAmir Shahabnia
29,310 PointsHey Faraz,
So the Patron class has a property named currentBook which is set to null when we create an instance of the Patron class.
When a patron checkouts a book, the currentBook property will be set to a book object. So now, the currentBook property of the patron object holds a value which is a book object the patron did checkout.
so until now, patron.currentBook refers to the book the patron checkouts (this book has different properties and dueDate is one of them). In the Book class, we have a dueDate property which we did set when a patron checkout a book.
As a result, patron.currentBook.dueDate refers to the due date of the the book a patron checkout.