Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftstatic vs dynamic witness dispatchSingle-choice MCQ

A protocol extension declares a method that is NOT a requirement of the protocol, and a conforming struct also declares a method with the same signature. The value is referenced through the protocol type. Which implementation runs and why?

protocol P {} extension P { func greet() { print("P ext") } } struct S: P { func greet() { print("S") } } let x: P = S() x.greet()