import Foundation
protocol A {
func show() -> Void
}
protocol B {
func eat() -> Void
}
protocol C: A,B{
func run() -> Void
}
class One: A {
func show() {
print("A类的show方法")
}
}
class Tow: B {
func eat() {
print("吃")
}
}
class Three: C {
func show() {
print("A类的show方法")
}
func eat() {
print("吃")
}
func run() {
print("��")
}
}
func test(obj:A&B) -> Void {
}
var one = One()
var two = Tow()
var three = Three()
test(obj: three)
Swift协议合成
最新推荐文章于 2025-08-16 21:17:00 发布