# Unit 8 – Advanced Demo: Trackable, Reroutable, Shipment, Package, Flight

The basic demo showed two unrelated classes sharing an interface. This
demo adds a class hierarchy: `Package` now extends the abstract class
`Shipment` and also implements `Trackable` and `Reroutable`. `Flight`
still implements `Trackable` only — it is not a `Shipment` and cannot be
rerouted. The same interface works across both the hierarchy and the
standalone class.

## Setting up

1. Compile all six files.

## Experimenting

2. Create a `Package`:
   `Package("PKG-001", "Berlin", "Madrid", "DHL", 2.5)`.
3. Call `statusSummary()` — the default from `Trackable`.
4. Call `shipmentInfo()` — from `Shipment`, the parent class.
5. Call `reroute("Lisbon")` — from `Reroutable`.
6. Call `rerouteInfo()` — the default from `Reroutable`.
7. Create a `Flight`:
   `Flight("LH476", "Frankfurt", "New York")`.
8. Call `statusSummary()` — the overridden version.
9. Try calling `reroute(...)` or `shipmentInfo()` on `Flight` — these
   are not available; `Flight` does not implement `Reroutable` or
   extend `Shipment`.
10. Call `dispatch` passing the `Package` object and `"Lisbon"` — status
    prints and the package is rerouted.
11. Call `dispatch` passing the `Flight` object and `"Lisbon"` — status
    prints but rerouting is skipped.

## What to look at in the code

12. `Package` extends `Shipment` and implements two interfaces — it has
    three types simultaneously: `Shipment`, `Trackable`, and `Reroutable`.
13. `Flight` implements only `Trackable` — it shares the interface but
    not the parent class or the second interface.
14. `dispatch()` in `Functions` accepts a single `Trackable` — both
    `Package` and `Flight` can be passed. Inside, it checks
    `is Reroutable` to decide whether to reroute, demonstrating a runtime
    check across interface boundaries.
15. `Package` inherits `shipmentInfo()` from `Shipment` and
    `rerouteInfo()` from `Reroutable` — defaults it does not need to
    override.
16. The colon syntax: `Shipment(id, from, to), Trackable, Reroutable` —
    the parent class comes first with constructor arguments; interfaces
    follow with no parentheses.
