Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

How do you call a constructor for a parent class?

Ads

 
 

Share on Google+Share on Google+

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

How do you call a constructor for a parent class?

Ads
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


Ads