次のようなクラスがあるとしましょう:
class father {
function __construct() {
$msg = "Blah...\n";
print $msg;
}
function doSomething() {
$msg = get_class($this) . " does something...\n";
print $msg;
}
}
そして、次のような子クラス:
class child extends father {
function __construct() {
$this->doSomething()
}
}
と:
class eldest extends father {
function __construct() {
$this->doSomething()
}
}
父クラスの子 (この場合は子と最年長)の現在のインスタンスの配列を返す方法はありますか?