Class Inheritance with PHP | 2

Class Inheritance with PHP

Putting the classes to use

Once the classes have been created it's just a matter of putting them to use. In a real-world situation we would be tying these classes to a database and creating multiple car objects to use in our online storefront. For the example in this article we include the objects and create a new car instance.

The car instance in this example is a Land Rover, a Range Rover with a price, photo and description. Once all of these properties have been set through the constructor we can call the getters and write out the information to the current document.

About the Author

Kris Hadlock is the owner and founder of Studio Sedition (http://www.studiosedition.com), a Web design and development firm. He is the author of Ajax for Web Application Developers and has been a feature writer for numerous Web sites and design magazines. To learn more about Kris, visit his Web site at www.studiosedition.com or his blog at blog.studiosedition.com

Digg This Add to del.icio.us

 

 

 

 

 

 

 

 

 

 

 

 

To page 1current page
[previous]

Created: August 14, 2007
Revised: September 12, 2007

URL: http://webreference.com/programming/php/class_inherit