com>
Zend Framework in Action (Ch01) Manning Publications Co. 52
1 This variable is only available in ZFiA_Author
2 Member function
The ZFiA_Author class inherits all the properties and methods of the ZFiA_Person class. It can also have
its own properties (#1) and functions (#2). You can overwrite the methods by creating new methods with the
same name in the child class, or you can use the methods of the parent class simply by calling them, you do not
need to redefine them.
17.1.4 Abstract classes and interfaces
Two new features of PHP5 are interfaces and abstract classes. Some classes are designed purely to be extended
by other classes. These classes are known as abstract classes and act as a skeleton implementation of a concept
that is then fleshed out by child classes. Abstract classes contain their own member variables and functions
along with declarations of functions that must be defined by the concrete child classes. For instance, we could
make ZFiA_Person an abstract class where we determine that all people will have a first name and surname,
but leave the definition of how to present their formal name to the child classes, as shown in listing 17.6.
Listing 17.5 An Abstract class contains undefined functions that must be implemented by child classes.
Pages:
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373