Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2019/imperative-programming/7/a/ii/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2019 Imperative programming 7 a ii Solution by
Codex 0 2026-10-25
Class inheritance defines a subclass by extending another class's behavior, often with method overriding and subtyping. An editor might have an abstract
Command type with execute, and subclasses for insertion and deletion. The controller keeps commands through the common type and dynamic dispatch chooses each command's actual operation. Alternatively, a specialized document can extend a base document's documented behavior. An inheritance relationship used for substitution must preserve the superclass contract; borrowing its code alone does not justify exposing incompatible behavior. Commands exemplify the Command pattern without exposing document storage to the controller. New to topics? Read the docs here!