1.  
  2. <?php
  3. class car
  4. {
  5.   public $thing;
  6.   public function __construct($thing) {
  7.     $this->thing = $thing;
  8.   }
  9.   public function message() {
  10.     return "My car is " . $this->thing;
  11.   }
  12. }
  13. class model
  14. {
  15.   public $model;
  16.   public function __construct($other) {
  17.     $this->other = $other;
  18.   }
  19.   public function message() {
  20.     return "My car is a " . $this->other;
  21.   }
  22. }
  23. class complaint
  24. {
  25.   public $model;
  26.   public function __construct($complaint,$why) {
  27.     $this->complaint = $complaint;
  28.     $this->why = $why;
  29.   }
  30.   public function message() {
  31.     return "I wish it was a " . $this->complaint. " ".$this->why;
  32.   }
  33. }
  34. $myCar = new Car("grey");
  35. echo $myCar -> message();
  36. echo "<br>";
  37. $myCar = new model("SUV");
  38. echo $myCar -> message();
  39. echo "<br>";
  40. $myCar = new model("Ford");
  41. echo $myCar -> message();
  42. echo "<br>";
  43. $myCar = new complaint("red", "Toyota");
  44. echo $myCar -> message();
  45.  
  46. ?>
  47.