How to overriding a function of a base class in PHP

1 Answer

0 votes
class A {

    function show() {
        echo "the A class";
    }
}

class B extends A {

    function show() {
        echo "the B class";
    }
}

$o_b = new B;
$o_b->show();


/*
run:

the B class

*/

 



answered Oct 14, 2016 by avibootz
...