runkit_class_adopt
(PECL runkit:0.7-0.9)
runkit_class_adopt — ある基底クラスを、他のクラスを継承させたクラスに変換する。親クラスの適切なメソッドを追加する
説明
bool runkit_class_adopt
( string $classname
, string $parentname
)
パラメータ
- classname
-
変換の対象となるクラス。
- parentname
-
継承させる親クラス。
返り値
成功した場合に TRUE を、失敗した場合に FALSE を返します。
例
Example#1 runkit_class_adopt() の例
<?php
class myParent {
function parentFunc() {
echo "Parent Function Output\n";
}
}
class myChild {
}
runkit_class_adopt('myChild','myParent');
myChild::parentFunc();
?>
上の例の出力は以下となります。
Parent Function Output