如何在 php 中使用继承实例化带有函数内部的函数
How to instantiate a function with a function inside using inheritance in php
是否可以使用继承在另一个函数中回显一个函数?请教我怎么做?
<?php
class Clinic extends Patient{
function getPatientsInfo(){
echo $this->GeneralInfo();
}
}
$patient = new Clinic;
$patient->getPatientsInfo();
如果 GeneralInfo() public 或在 Patient class 内部受到保护,那么您可以使用。
是否可以使用继承在另一个函数中回显一个函数?请教我怎么做?
<?php
class Clinic extends Patient{
function getPatientsInfo(){
echo $this->GeneralInfo();
}
}
$patient = new Clinic;
$patient->getPatientsInfo();
如果 GeneralInfo() public 或在 Patient class 内部受到保护,那么您可以使用。