- 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 } }
1 Resposta
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();
}
}