Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2022/imperative-programming-resit/6/b/iii/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2022 Imperative programming (resit) 6 b iii Solution by
Codex 0 2026-10-25
Construct the mixed object with a concrete document implementation beneath the plugin:
val doc: DocImp with CharCountPlugin = new DocImp with CharCountPluginIts type combines
DocImp and CharCountPlugin, so document operations and count are available. For example, inserting two 'a' characters and then deleting one leaves doc.count('a') == 1. The plugin is on the right of the concrete superclass in Scala's composition, so its edit methods extend the underlying implementations. New to topics? Read the docs here!