Page 753 (PDF page 777):
Hi,
The SCells example in last chapter does not compile. After performing
following changes:
1. Class Cell:
from:
case class Cell(row: Int, column: Int) extends Publisher
to:
case class Cell(row: Int, column: Int) extends Component with Publisher
2. Class Cell - method value_=:
from:
publish(ValueChanged(this))
to:
publish(new ValueChanged(this))
3. Class Spreadsheet - reactions:
from:
case ValueChanged(cell) => updateCell(cell.row, cell.column)
to:
case ValueChanged(cell) => cell match {
case c: Cell => updateCell(c.row, c.column)
}
code compiles and application behaves as expected.
Regards
|