2020-03-20 18:30:46 +03:00
|
|
|
## Nested Classes (#4)
|
|
|
|
|
|
|
|
Improve the implementation of the *State* pattern in `Ticket.kt`. Change `Seat`
|
|
|
|
from an enumeration to a non-nested `abstract class`, with a nested subclass
|
|
|
|
for each `Seat` type. `Seat` contains `abstract` member functions for
|
2020-05-12 19:08:29 +03:00
|
|
|
`upgrade()` and `meal()`. There's also a `toString()` for `Seat` that produces
|
|
|
|
the `simpleName` of the specific subclass.
|
2020-03-20 18:30:46 +03:00
|
|
|
|
|
|
|
`Ticket` now becomes a simple holder for a `Seat` object, along with
|
|
|
|
`upgrade()` and `meal()` functions which forward their actions to the `Seat`
|
|
|
|
object.
|
|
|
|
|
2020-09-29 14:29:57 +03:00
|
|
|
Bonus (Challenging): Why can't you use delegation for `seat` in `Ticket`?
|
|
|
|
|
2020-10-12 12:47:44 +03:00
|
|
|
<sub> This task doesn't contain automatic tests,
|
|
|
|
so it's always marked as "Correct" when you run "Check".
|
|
|
|
Please compare your solution with the one provided! </sub>
|