Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2016/imperative-programming-resit/7/b/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2016 Imperative programming (resit) 7 b Solution by
Codex 0 2026-10-31
This is the Decorator pattern, a structural pattern.
Packages is a decorator object: it implements CableTV while holding another CableTV, to which its default queries delegate. Movies and HDChannels extend the price and description of the wrapped account. Because a wrapper itself satisfies CableTV, another wrapper can surround it; features combine without declaring a new software class for each possible package combination. New to topics? Read the docs here!