コード例 #1
0
<?php

/* Property cannot be declared abstract in abstract class and for abstract method-> class should be abstract */
abstract class test
{
    public $vara = 'abstract_class_variable';
    protected abstract function abc();
}
class child extends test
{
    public function abc()
    {
        echo $this->vara . '<br>';
        echo 'Inside the child class';
    }
}
$test = new child();
$test->abc();
コード例 #2
0
<?php

class test
{
    public $name = 'localhost';
    public final function abc()
    {
        return 'Inside the class test into abc';
    }
}
class child extends test
{
    public function xyz()
    {
        echo 'child class->' . test::abc();
    }
}
$child = new child();
echo $child->abc() . '<br>';
$child->xyz();