0
我被卡住了。 我儘量讓正確的代碼的設計師,但我解決不了下面的情況: 我有一些基類繼承自它的類,如:如何通過基類獲得子類中的某些參數
class BaseClass {
var name: String
init(name: String) {
self.name = name
}
}
class ChildClass: BaseClass {
var otherName: String
init(otherName: String) {
self.otherName = otherName
}
}
而下面的功能:
func someFunc() -> BaseClass {
let a = ChildClass.init(otherName: "NAME")
return a
}
哪有我得到參數「otherName」? 可用的參數只有一個 - 「名」,但我想「中文別名」:
let b = someFunc()
b.PARAMETERS
謝謝!我忘了它 – Movash
不客氣! :) –