Object Methods

Lesson 31
Author : Afrixi
Last Updated : November, 2017


Table of Content

Code

Copyclass Student{
     public $name;
     public $gpa;

     function __construct($name, $gpa){
          $this->name = $name;
          $this->gpa = $gpa;
     }

     function hasHonors(){
          if($this->gpa >= 3.5){
               return true;
          }
          return false;
     }
};