php实例-继承

name,"\t is",$this->gender,"\r\n";
		}
	}
	class family extends person{
		public $name;
		public $gender;
		public $age;
		static $money=100000;
		public function __construct(){
			parent::__construct();
			echo'这里是子类',php_eol;
		}
		
		public function say(){
			parent::say();
			echo $this->name,"\t is \t",$this->gender,",and is\t",$this->age,php_eol;
		}
		public function cry(){
			echo parent::$money,php_eol;
			echo '%>_<%',php_eol;
			echo self::$money,php_eol;
			echo '(*^_^*)';
		}
	}
	
	$poor= new family();
	$poor->name='Lee';
	$poor->gender='female';
	$poor->age=25;
	$poor->say();
	$poor->cry();
?>

你可能感兴趣的:(PHP)