Home >Backend Development >PHP Tutorial > 关于php承袭的疑惑
关于php继承的疑惑
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php class A { [color=#FF0000]private[/color] $name = "Nciaer"; public function say() { echo $this -> name . "<br>"; } } class B extends A { public $name = "Fansa"; } $b = new B(); $b -> say(); ?>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php class A { [color=#FF0000]public[/color] $name = "Nciaer"; public function say() { echo $this -> name . "<br>"; } } class B extends A { public $name = "Fansa"; } $b = new B(); $b -> say(); ?>