linked lists w/ classes

For everyone, just starting with C++ or programming at all. Ask newbie questions in this forum!

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

Re: linked lists w/ classes

Postby Jimbo » Tue Oct 07, 2003 9:44 pm

dillausky wrote:would i just create one instance of book at the top and use that to reference the book attributes?

you could use it to read the attributes for it and, by following the linked list, for the other books too.
dillausky wrote:since this function is of the library class, will it let me use the book variables(since they are private they shouldnt be able to, right?)?

not necessarily. you could, in the Book class definition, define [color="blue"]friend class[/color] Library; that code would allow Library to read the private members of Book.
dillausky wrote:what would the syntax be for assigning all three values for each block of the LL?

depends on how the book class is implemented. you could use a constructor, or create a function to set the variables if the object has already been created.

HTH
User avatar
Jimbo
 
Posts: 601
Joined: Thu Sep 25, 2003 6:48 pm
Location: Seattle


Return to For Beginners

Who is online

Users browsing this forum: No registered users and 1 guest