I am having trouble understanding why t
and tt
are treated differently. Obviously it has to due with what is specified directly in protocol A, but what is the logic here for this difference?
protocol A {
var t : Int {get}
}
extension A {
var t : Int {
return 1
}
var tt : Int {
return 1
}
}
struct B : A {
var t = 2
var tt = 2
}
let a:A = B()
print(a.t, a.tt) //"2 1"
let b:B = B()
print(b.t, b.tt) //"2 2"