WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : An updated OOP - Inheritance
Categories : PHP, PHP Classes, Object Oriented Click here to Update Your Picture
Juma Nabongo
Date : Apr 26th 2003
Grade : 3 of 5 (graded 7 times)
Viewed : 8795
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Juma Nabongo
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?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