Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Child Class

A child class is a class that extends another class. There is no specific keyword related to child classes: unlike parent which is unique and defined, any class that extends a class is its child. A class may have several children.

A child class may be the direct child of a class, or any of the own child.

<?php

// parent class
class Elephpant { }

// child class
class AfricanElephpant extends Elephpant {}

// child class of Elephpant
// child class of AfricanElephpant
class Calf extends AfricanElephpant {}

?>

Documentation

See Also