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)修行中......
interface Arrayable {
public function toArray();
}
class parent implents Arrayable {
public function toArray() {
// to do
};
}
class children extends parent{
}
Write an interface implementation, or use the parent class for inheritance