Consider the following situation:
protocol P {
associatedtype T = String
func f()
}
extension P {
func f() {print("I want to reuse this function")}
}
class A: P {
func f() {
(self as P).f() // can't compile
print("do more things.")
}
}
If there is no associatedtype
, the expression (self as P).f()
is OK.
Is there a method to reuse P.f()
when P
has associtedtype
?