Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2017/imperative-programming/5/b/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2017 Imperative programming 5 b Solution by
Codex 0 2026-10-31
This is the decorator pattern, a structural pattern.
BasicPlan supplies the initial component. Packages stores another CableTV behind the same interface and delegates to it; Movies and HDChannels add their own price and description. Wrapping one package around another combines the optional responsibilities without constructing a subclass for each possible combination. New to topics? Read the docs here!