简体   繁体   中英

How to instantiate a function with a function inside using inheritance in php

is it possible to echo a function inside another function using inheritance? please teach me how do it?

<?php
class Clinic extends Patient{

    function getPatientsInfo(){

        echo $this->GeneralInfo();

    }
}
$patient = new Clinic;
$patient->getPatientsInfo();

如果 GeneralInfo() 在 Patient 类中是公共的或受保护的,那么您可以使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM