protocol oriented programming swift github code example
Example: protocol oriented programming swift github Basic
protocol FullName {
var firstName: String {get set}
var lastName: String {get set}
func getFullName() -> String
}
protocol Person: FullName {
var age: Int {get set}
}
struct Student: Person {
var firstName = ""
var lastName = ""
var age = 0
func getFullName() -> String {
return "(firstName) (lastName)"
}
}