protocol SomeProtocol {
var mustBeSettable: String { get set }
}
class Stage1: SomeProtocol {
//Here "mustBeSettable" should be {get set}
}
class Stage2: SomeProtocol {
//Here "mustBeSettable" should be {get} only
}
在 Stage1 类中,我需要作为 {get set} 访问“mustBeSettable”,而在 Stage2 类中,“mustBeSettable”应该只是 {get}。但我需要在两个类中使用相同的属性。