<?php class Box1 { public static function hoge(){ Box2::hoge(); } } class Box2 { public static function hoge(){ echo 'Gold' . PHP_EOL; } } Box1::hoge(); ?>
サンプル2
<?php class Tse2 { public static function reg(){ self::cap(); } public static function cap(){ echo "時価総額20億円以上". PHP_EOL; } } class Tse1 extends Tse2 { public static function cap(){ echo "時価総額250億円以上". PHP_EOL; } } Tse2::reg(); Tse1::reg(); ?>
<?php class Tse2 { public static function cap(){ echo "時価総額20億円以上". PHP_EOL; } } class Tse1 extends Tse2 { public static function reg(){ parent::cap(); } public static function cap(){ echo "時価総額250億円以上". PHP_EOL; } } Tse1::reg(); ?>