Define a parent class Person (person), including two attribute members xm (name), xb (gender) and a constructor. xm and xb cannot be read and written directly in the main program. Name, xb are completed in the constructor. Initialization of gender.
Define a subclass teacher (teacher) inherited from Person, including the attribute gh (employee number) and a constructor. You cannot directly read and write gh in the main program. The constructor can be used to initialize all data members. And define a method in the subclass to output all teacher information, and define a destructor to display "Goodbye".
There is currently a teacher "李思", gender "male", and job number 123. Please initialize it with this data and output
Miss等待2019-01-10 16:00:49
<?php
class Person
{
protected $xm;
protected $xb ;
function __construct()
{
$this->xm = '李思';
$this->xb = 'Male';
}
## class Teacher extends Person
{
protected $gh;
## function __construct()
$this->gh = 123; $this->xm = '李思'; $this->xb = 'Male';
}
public function message()
function __destruct( )
}
echo $teacher->message();