Create a new instance in a static function of an abstract class
- by arno
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 create instances of a class from a static method defined in the abstract parent class but PHP tells me "Fatal error: Cannot instantiate abstract class ..." How should I implement it correctly?