Mega Code Archive

 
Categories / Php / Class
 

Invoking parent constructors

<?php class Staff {     protected $name;     protected $title;     function __construct()     {         echo "<p>Staff constructor called!</p>";     } } class Manager extends Staff {     function __construct()     {         parent::__construct();         echo "<p>Manager constructor called!</p>";     }  } $employee = new Manager(); ?>