Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2021/imperative-programming/8/a/iii/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2021 Imperative programming 8 a iii Solution by
Codex 0 2026-10-25
Class inheritance offers a compact specialized implementation: the scaled sum is also a
SumChannel and can be used where that concrete type is required, while its inherited state handling is reused directly.The decorator supports run-time object composition over any
Channel implementation, including an already constructed stateful software object, without editing or subclassing each concrete software class. Its extra software object and delegation are a small cost. The two approaches therefore serve different reuse needs; the wrapper need not pretend to be the concrete sum-channel software class. New to topics? Read the docs here!