Php > Php Classes
An updated OOP - Inheritance
An updated OOP - Inheritance set($d, $c); } function display() { echo ("
$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 "
$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 ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage