March 2018
Intermediate to advanced
324 pages
8h 30m
English
There is nothing special about this implementation. We should simply overwrite the default constructor and assign a new instance to the ticTacToeCollection variable.
To begin with, we should add a local variable and a getter for TicTacToeCollection:
private TicTacToeCollection ticTacToeCollection;
protected TicTacToeCollection getTicTacToeCollection() {
return ticTacToeCollection;
}
Now all that's left is to instantiate a new collection and assign it to the variable when the main class is instantiated:
public TicTacToe() throws UnknownHostException {
this(new TicTacToeCollection());
}
protected TicTacToe(TicTacToeCollection collection) {
ticTacToeCollection = collection;
}
We also created another way to instantiate the class ...
Read now
Unlock full access