【发布时间】:2014-08-31 19:28:59
【问题描述】:
我尝试通过从两个类继承来创建 myPet,但错误例如:
import UIKit
class SecondViewController: UIViewController, UITextFieldDelegate {
// No Error
}
然后定义了以下类,然后创建新类 myPets,我喜欢继承 Dog 和 Substance。但错误:从类“狗”和“物质”的多重继承
class Dog:Animal {
func sound()->String {
return "Hong Hong"
}
}
class Substance {
func livingCompound()->String {
return "Consist of bio-molecule"
}
}
class myPets:Dog, Substance {
func itsAddress()->String {
// Error:Multiple inheritance from classes 'Dog' and 'Substance'
}
}
【问题讨论】:
标签: swift