Skip to content
Advertisement

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

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement