PHP如何實(shí)現(xiàn)子類的屬性全部都有 toArray()方法?
調(diào)用之后 ,變成了數(shù)組
父類如何設(shè)計(jì)呢??
閉關(guān)修行中......
interface Arrayable {
public function toArray();
}
class parent implents Arrayable {
public function toArray() {
// to do
};
}
class children extends parent{
}
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://m.miracleart.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)