亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

class - How does PHP implement that all subclass attributes have toArray() method?
阿神
阿神 2017-05-16 12:59:22
0
3
668

How to implement in PHP that all properties of subclasses have toArray() method?

After calling, it becomes an array

How to design the parent class? ?

阿神
阿神

閉關(guān)修行中......

reply all(3)
小葫蘆
interface Arrayable {
    public function toArray();
}

class parent implents Arrayable {
    public function toArray() {
        // to do
    };
}

class children extends parent{

}
給我你的懷抱

Just write a toarray method for the parent class, that’s it,

劉奇

Write an interface implementation, or use the parent class for inheritance

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template