Untitled

 avatar
unknown
plain_text
a year ago
464 B
5
Indexable
<?php
class Student{
    private $name;
    private $age;
    public function __construct($name,$age)
    {
        $this->name = $name;
        $this->age = $age;
    }
    public function getInfo(){

        return(print_r($this));
    }
}
$student2 = new Student("hari",223);
$student2->getInfo();
class Topper extends Student{
    public function getInfo(){
        return parent::getInfo();
    }
}
$student3 = new Topper("Peter",23);
$student3->getInfo();
?>
Editor is loading...