<?php
class Person
{
public $name;
function __construct($n) //default constructor
{
$this->name=$n;
}
function display() //default function with no arguement.
{
echo "Person Details <br> Name:= $this->name" ;
}
}
class Student extends Person
{
public $rollNo;
function __construct($n,$r)
{
$this->name=$n;
$this->rollNo=$r;
}
function print()
{
echo "<br>Student Details :<br>name= $this->name";
echo "<br> rollNo= $this->rollNo";
}
}
$p1= new person('tom');
$p1->display();
$s1= new Student('john',4563);
$s1->print();
?>