This is a big php programming question. I have no choice. Please help.
有为鱼
有为鱼 2019-01-08 15:02:44
0
3
1092

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


有为鱼
有为鱼

reply all(2)
Miss等待

<?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()

{

return "The name is: {$this->xm} Gender is: {$this->xb} Job number is: {$this->gh}";

}

function __destruct( )

{

// return 'Goodbye!';

echo 'Goodbye! ';

}

}

##$teacher = new Teacher();


echo $teacher->message();

空城

You posted it, I was stunned by what you said

  • reply I also want someone to give me the answer. If not, I wouldn’t have posted this post.
    有为鱼 author 2019-01-09 15:01:44
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template