11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoC H A P T E R 7• • •Advanced OOP FeaturesChapter 6 introduced the fundamentals of object-oriented programming (OOP). This chapter builds onthat foundation by introducing several of <strong>PHP</strong>’s more advanced OOP features. Specifically, this chapterintroduces the following five features:Object cloning: One of the major improvements to <strong>PHP</strong>’s object-oriented model inversion 5 is the treatment of all objects as references rather than values. However,how do you go about creating a copy of an object if all objects are treated asreferences? By cloning the object.Inheritance: As discussed in Chapter 6, the ability to build class hierarchiesthrough inheritance is a fundamental OOP concept. This chapter introduces <strong>PHP</strong>’sinheritance features and syntax, and it includes several examples that demonstratethis key OOP feature.Interfaces: An interface is a collection of unimplemented method definitions andconstants that serves as a class blueprint. Interfaces define exactly what can bedone with the class, without getting bogged down in implementation-specificdetails. This chapter introduces <strong>PHP</strong>’s interface support and offers severalexamples demonstrating this powerful OOP feature.Abstract classes: An abstract class is a class that cannot be instantiated. Abstractclasses are intended to be inherited by a class that can be instantiated, betterknown as a concrete class. Abstract classes can be fully implemented, partiallyimplemented, or not implemented at all. This chapter presents general conceptssurrounding abstract classes, coupled with an introduction to <strong>PHP</strong>’s classabstraction capabilities.Namespaces: Namespaces help you to more effectively manage your code base bycompartmentalizing various libraries and classes according to context. In thischapter I’ll introduce you to <strong>PHP</strong> 5.3’s new namespace feature.■ Note All the features described in this chapter are available only for <strong>PHP</strong> 5 and newer.159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!