- 1

How to initialize the constructor

Public class Library{ private Catalogue catalogue; private LinkedList<Patron> patrons; public library(){ //what code to initialise } } And another CLASS public class Catalogue{ private Library library; private LinkedList<Book> books; public catalogue( Library library){ //what code to initialize } }

6th Sep 2017, 9:06 PM
Jake
1 Antwort
0
public class Library{ private Catalogue catalogue; private LinkedList<Patron> patrons; public Library(){ //code to initialise patrons = new LinkedList(); catalogue = new Catalogue(this); } } And another CLASS public class Catalogue{ private Library library; private LinkedList<Book> books; public Catalogue(Library library){ //code to initialize this.library = library; books = new LinkedList(); } }
13th Sep 2017, 8:08 PM
Victor IT
Victor IT - avatar