2021年3月13日星期六

Type 'American' does not conform to protocol 'Food'

have been fighting the code for some time now, and can't resolve the issue of: Type 'American' does not conform to protocol 'Food'

protocol Food {      var type: String { get }      var ingredient1: String { get }      var price: Int { get set}      func showHistory()       mutating func transfer()        init(type: String)      init(ingredient1: String)  }    struct American: Food {      let type: String       let ingredient1: String      var price: Int = 125        init(type: String, ingredient1: String) {          self.type = type          self.ingredient1 = ingredient1      }        func showHistory() {              print("American history")      }        mutating func transfer() {             print("transfering burgers")      }  }  
https://stackoverflow.com/questions/66620648/type-american-does-not-conform-to-protocol-food March 14, 2021 at 10:53AM

没有评论:

发表评论