# 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

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

## What to look at in the code

1. `Package` extends `Shipment` and implements two interfaces — it has 
   three types simultaneously: `Shipment`, `Trackable`, and `Reroutable`.
2. `Flight` implements only `Trackable` — it shares the interface but 
   not the parent class or the second interface.
3. `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.
4. `Package` inherits `shipmentInfo()` from `Shipment` and 
   `rerouteInfo()` from `Reroutable` — defaults it does not need to 
   override.
5. The colon syntax: `Shipment(id, from, to), Trackable, Reroutable` — 
   the parent class comes first with constructor arguments; interfaces 
   follow with no parentheses.
