Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftprotocol witness tablesSingle-choice MCQ

A protocol has a requirement `func draw()` and a protocol extension that supplies a default `draw()` plus a non-requirement method `func describe()`. A struct `Shape` conforms and overrides BOTH. Given the code below, what does it print, and why?

protocol Drawable { func draw() } extension Drawable { func draw() { print("ext.draw") } func describe() { print("ext.describe") } } struct Shape: Drawable { func draw() { print("shape.draw") } func describe() { print("shape.describe") } } let d: Drawable = Shape() d.draw() d.describe()