swift - Inhereted protocols conformance -
this question has answer here:
i want implement next code structure:
// base hierarchy definition protocol {} protocol c { var a: { set } } // specific definition protocol b: {} struct testclass: c { var a: b }
- protocol
c
requires variable of typea
. - protocol
b
inheriteda
. - class
testclass
implementsc
protocol defining variable of typeb
(what should ok in order of2
)
but swift compiler complains testclass
doesn't conform protocol c because candidate has non-matching type 'b'
.
why swift compiler takes type b
non-matching type a
?
Comments
Post a Comment