代码:<?php
class father{
static $stvar="This is a satic var of Father<br>";
static function stfun(){
echo "This is the static function of FATHER<br>";
}
}
echo father::$stvar;
father::stfun();
class son extends father{
}
echo son::$stvar;
son::stfun();
class dauther extends father{
static $stvar="This is a satic var of DAUGHTER<br>";
static function stfun(){
echo "This is the static function of DAUGHTER<br>";
}
}
echo dauther::$stvar;
dauther::stfun();
?>结果是:
This is a satic var of Father
This is the static function of FATHER
This is a satic var of Father
This is the static function of FATHER
This is a satic var of DAUGHTER
This is the static function of DAUGHTER
class father{
static $stvar="This is a satic var of Father<br>";
static function stfun(){
echo "This is the static function of FATHER<br>";
}
}
echo father::$stvar;
father::stfun();
class son extends father{
}
echo son::$stvar;
son::stfun();
class dauther extends father{
static $stvar="This is a satic var of DAUGHTER<br>";
static function stfun(){
echo "This is the static function of DAUGHTER<br>";
}
}
echo dauther::$stvar;
dauther::stfun();
?>结果是:
This is a satic var of Father
This is the static function of FATHER
This is a satic var of Father
This is the static function of FATHER
This is a satic var of DAUGHTER
This is the static function of DAUGHTER
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货