Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP How do you call a constructor for a parent class?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


brijesh
How do you call a constructor for a parent class?
2 Answer(s)      4 years and a month ago
Posted in : PHP


How do you call a constructor for a parent class?


Advertisement
View Answers

November 15, 2010 at 2:45 PM


Hi everyone,

You can call parents class constructors by using parent keyword.

Example :

class parent { function __construct(){ // some code } }

class child extends parent { function __construct() { parent::__construct(); // some code } }

Thanks



November 15, 2010 at 2:46 PM


Hi everyone,

You can call parents class constructors by using parent keyword.

Example :

class parent { function __construct(){ // some code } }

class child extends parent { function __construct() { parent::__construct(); // some code } }

Thanks



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com