The Method Of A Child Class Overriding That Of Its Parent

<title>The Method of a Child Class Overriding That of Its Parent</title>
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");

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.