Swift does not support multiple inheritance, How could be achieved?
问题 The following code: class City { var cityId : String? var cityName : String? } class Town { var townid : String? var townName : String? } class Address : City , Town { var house : String? var street: String? } Generates a compile-time error: Address.swift:38:24: Multiple inheritance from classes 'City' and 'Town' How can I solve his kind of problem? What approach to follow? 回答1: It seems you are overthinking things. Instead of inheritance, try to use more composition. An address should not