Solution (source code)

= Solution

The constructor stores a reference, not a copy:
``
val d = new Dimension(3, 4)
val f = new Frame(d)
d.width = 10
``
Now \b[`f.area` is still $12$, but the product of its stored dimension fields is $40$]. Even without retaining `d`, a client can break the same invariant through `f.dimension.height = 9`, because the accessor exposes the same mutable object. This is <representation exposure> through <reference aliasing>. A `val` prevents reassigning the reference; it does not freeze the referenced object.