我想了解Go的類型轉換規則。假設我們有以下接口: type woofer interface {
woof()
}
type runner interface {
run()
}
type woofRunner interface {
woofer
runner
}
,並滿足我們有一個dog類型的接口: type dog struct{}
看到這個實現蘋果和桔子遵循上限例如http://docs.scala-lang.org/tutorials/tour/upper-type-bounds.html class Fruit(name: String)
class Apple (name: String) extends Fruit(name)
class Orange(name: String) extends Fruit(na
class Param() {
}
class Subparam extends Param {
}
class Base {
function mymethod(Param a) {
}
}
class Sub extends Base {
function mymethod(Subparam a) {
}
}
如何做在PHP中,這會導致一個