abstract class db_table { static function get_all_rows() { ... while(...) { $rows[] = new self(); ... } return $rows; } } class user extends db_table { } $rows = user::get_all_rows();
I want to instantiate a class from a static method defined in an abstract parent class, but PHP tells me: "Fatal error: cannot instantiate an abstract class ..." How to implement it correctly?
Edit: Of course, I want to create instances of the user class in this case, not an abstract class. So I have to tell him to instantiate the called subclass.
arno source share