|
|
|
<?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;
}
}
class sportcar extends Car {
var $tyres;
function sportcar($d, $c, $t) {
$this->set($d, $c);
$this->tyres = $t;
}
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
$ordinary->display();
$scar->displays(); //scar : Sportcar
?> |
|
| Advanced Image WaterMarker Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented | | | EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly. Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library | | | Access_user Class - an easy to use system for protecting pages and register users. Categories : PHP, Classes and Objects, Object Oriented, PHP Classes, Authentication | | | SPL and ITERATOR : examples Categories : PHP, Object Oriented, PHP Classes, Sessions | | | OO Site Template Categories : PHP, PHP Classes, Object Oriented | | | Client classes for Dictionary servers UPDATED: 2000-06-06 Categories : Network, Search, Complete Programs, PHP Classes, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Authorize.net AIM Interface Class v1.0.0 Categories : PHP, PHP Classes, Ecommerce, Payment Gateways | | | Class that allows the PHP developer to create and manage UNIX like password files suitable for use as Apache authentication password files.
Categories : HTTP, PHP, PHP Classes, Filesystem | | | A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible Categories : PHP, PHP Classes, Filesystem | | | crop and resize image class using gd library function Categories : PHP, PHP Classes, GD image library, Graphics | | | Vote-Poll script that has a wrapper class that allows the user to create
multiple polls on the same page with little trouble. Categories : PHP, PHP Classes, HTML and PHP | | | Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support Categories : PHP, FTP, Filesystem, PHP Classes, Compression | | | Simple and fast user authentication Categories : PHP, PHP Classes, Authentication | | | POP3 Class Categories : PHP Classes, PHP, Email | |
|
|