Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftprotocol-oriented programmingSingle-choice MCQ

Contrast the previous case: here `bonus()` is NOT a protocol requirement. What does it print?

protocol Greeter { func hello() -> String } extension Greeter { func hello() -> String { "default" } func bonus() -> String { "base bonus" } } struct French: Greeter { func hello() -> String { "bonjour" } func bonus() -> String { "french bonus" } } let g: Greeter = French() print(g.bonus())