Home > Software design >  How to instantiate a function with a function inside using inheritance in php
How to instantiate a function with a function inside using inheritance in php

Time:11-11

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

CodePudding user response:

if GeneralInfo() is public or protected inside Patient class then you can use.

  • Related