Day: March 6, 2021

  • PHP Inheritance

    PHP Inheritance

    Way1 to inherit one class from another using the keyword extends <?php class Course{                 protected $courseCode;                 public function getCode($newCourseCode)                 {                                 $this->courseCode=$newCourseCode;                 } } class Subject extends Course{                 protected $subjectName;                 public function getCourse($newSubject)                 {                                 $this->subjectName=$newSubject;                 }                 public function showCourse(){                                                 echo “Student enrolled for <b>”.…