<html>
<head>
<title>The Method of a Child Class Overriding That of Its Parent</title>
</head>
<body>
<?php
class FirstClass{
var $name = "first class";
function FirstClass( $n ){
$this->name = $n;
}
function sayHello(){
print "Hello my name is $this->name<br>";
}
}
class second_class extends FirstClass {
function sayHello(){
print "say hi<br>";
}
}
$test = new second_class("new name");
$test->sayHello();
?>
</body>
</html>
|