<?php
/*PHP supports inheritance. Inheritance is the concept of one class being
devined as a special case of a more general class.
A Sport car is a car it inherits all its variables and functions from Car*/
class Car {
var $description; //The aim here is to display the description and the cost of car!
var $cost;
function Car($d, $c) {
$this->set($d, $c);
}
function display() {
echo ("<br>$this->description, $this->cost");
}
function set($d,$c) {
$this->description = $d;
$this->cost = $c;
}
function setDescription($d) {
$this->description = $d;
}
function getDescription() {
return $this->description;
}
}
function displays() { //This is a function to display items named ie tyres
echo "<br>$this->tyres"; // Here is to display the number of tyres
$this->display();
}
}
$ordinary = new Car("Ford", 29050.00); // Constructor - new car
$scar = new sportcar("Porshe",900000.00,4); // Constructor - new sportcar