php(oo 静态方法调用静态方法)
时间:2007-01-17 来源:liuxingyuyuni
?php
/**
* @author bianjiang
* @todo 练习静态方法调用/
* @desc
* 求最大值
*/
class Math
{
public static function Max($first, $second)
{
return ($first > $second)?$first:$second;
}
public static function Max3($first, $second, $third)
{
$one = self::Max($first, $second);
$two = self::Max($second, $third);
$res = self::Max($one, $two);
return $res;
}
}
$a = 1;
$b = 2;
$c = 3;
echo Math::Max3($a, $b, $c);
?>
相关阅读 更多 +
排行榜 更多 +