Content / help / extends .. concise-view << previous next >>

PHP extends heirarchy

Often you need classes with similar variables and functions to another existing class. It is good practice to define a generic class which can be used in all your projects and adapt this class for the needs of each of your specific projects. To facilitate this, classes can be extensions of other classes. The extended or derived class has all variables and functions of the base class. These functions and variables can be re-defined in the extend class. This is called inheritance An extended class is always dependent on a single base class, that is, multiple inheritance is not supported. Classes are extended using the keyword 'extends'. Although multiple inheritance from a single base class is not possible, you can 'daisy chain' down so that class B extends class A and class C extends class B, and so on

Constructors

If the child class does not have any __constructor function, it will use its parent's construct.




iBiscuits LOGO