Create two child classes : Class Inheritance « Class « PHP






Create two child classes

<?php
  class vehicle{
      var $brand_name;
      var $number_of_wheels;
      var $seating_capacity;
  }

  class car extends vehicle {
      var $doors;
      var $prooftype;
      var $powersteering;
      var $powerwindows;
  }

  class motorbike extends vehicle {
      var $engine;
  }

  $merk= new car;
  $dukat=new motorbike;

?>


           
       








Related examples in the same category

1.Inheriting a Shape Class
2.Improved Inheritance: call parent constructor
3.Creating a Class That Inherits from Another
4.Class inheritance in action